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
Differentiate between list and set.
How do you sort a collection in descending order?
What is indexing an array?
What are the different types of linked list?
What differences exist between hashmap and hashtable?
What is data algorithm?
Which sorting is best in time complexity?
Is treemap thread safe?
What does a bubble chart show?
How does a hashmap work?
What's difference between stack and queue?
How to get a list of tables, views and columns in firebird database?
Why is waste sorting important?
When would you use a hashmap?
What are b tree keys?