create an singly linked lists and reverse the lists by
interchanging the links and not the data?
Answer Posted / bharath
I am correcting Vaishali's method here,
We can achive this using following method:
Use three pointers
First is start pointing to first node.
Second is prev pointing to second node
Third is curr pointing to third node.
start->next=NULL;
while(start!=curr)
{
prev->next=start
start=prev;
prev=curr;
curr=curr->next;
}
This reverses the list.
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What are the Advantages and disadvantages of Array?
What are the categories of avl rotations?
What is nonlinear data?
What is storage structure in data structure?
How many passes are required in bubble sort?
Can we use Generics with the array?
Is learning data structures necessary?
What is an expression tree?
Define in brief an array.
What is selection in an algorithm?
What is the difference between collections class vs collections interface?
Which is the parent class of abstractqueue class?
Which is better array or linked list?
What happens in insertion sort?
Are duplicates allowed in list?