Please post your answer in comments if you have a better solution.
Keep linked list elements in reverse order. And print the linked list now. And do reverse again.
Like this:DisplayList(node){ if(node==NULL) return; DisplayList(node->next); Print(node->data);}
Post a Comment
2 comments:
Keep linked list elements in reverse order. And print the linked list now. And do reverse again.
Like this:
DisplayList(node)
{
if(node==NULL) return;
DisplayList(node->next);
Print(node->data);
}
Post a Comment