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 do you mean by Syntax Error
Define adjacent nodes?
Differentiate between hashmap and hashtable.
Define right-in threaded tree?
Explain what is linear search?
How treemap orders the elements if the key is a string?
What is the function of stack?
Which is best array or linked list?
List the area of applications of data structure.
What is the space complexity of selection sort?
Model a data structure for a DFA that takes an event as parameter and performs a desired action.
Run time memory allocation is known as in data structure?
How do you balance a tree?
What are the advantages of sorting?
What is a bubble sort and how do you perform it?