Saturday, May 26, 2007

How to read a singly linked list backwards?

Use Recursion.

2 comments:

Madan said...

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

Anonymous said...

Like this:

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