Saturday, May 26, 2007

How to read a singly linked list backwards?

Use Recursion.

2 comments:

  1. Keep linked list elements in reverse order. And print the linked list now. And do reverse again.

    ReplyDelete
  2. Like this:

    DisplayList(node)
    {
    if(node==NULL) return;
    DisplayList(node->next);
    Print(node->data);
    }

    ReplyDelete