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
Define disjoint set adt?
Is python good for freshers?
Are linked lists considered linear or non-linear data structures?
State the difference between queues and linked lists?
How many sorting techniques are there?
How many types of arrays are there?
What is the advantage of the heap over a stack?
How to fill element (initialize at once) in an array?
What is the structure of an array?
In tree construction which is the suitable efficient data structure?
Which is better hashset or treeset?
What is a minimum spanning tree?
What is collections singletonlist?
How many parts are there in a declaration statement using data structures?
Explain the difference between hashset and hashmap?