Thursday 2 August 2012

How do you reverse a single linked list without using any C pointers?

One way is to reverse the data in the nodes without changing the pointers themselves. (push the elements into the stack and copy the elements into the linked list in sequential order i.e., nothing but reversing a single linked list without using pointers)

The other way is to create a new list from the existing list in the reverse order.

No comments:

Post a Comment