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
Why is bubble sort stable?
When will you use array over arraylist?
Explain what is binary search?
How do I sort a hashmap key?
Explain the common uses of tree database.
What is binary tree give example?
what is the biggest advantage of linked lists?
What do you mean by free pool?
What is a node in it?
Differentiate between iterable and iterator.
Define a tree?
Does list maintain insertion order?
What is Doubly link list?
What is difference between list and linked list?
Why null is allowed in hashmap?