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 is ds tree?
What is the non linear data structure?
What is data structure definition?
How do you insert a new item in a binary search tree?
What is stack push?
Why is quicksort not stable?
Is a hash table a map?
Can we change the size of an array at run time?
Does hashmap sort automatically?
Reverse a linked list from the middle.
How many types of data structures are there?
Define static data structures?
What is subtree?
What is structured data with example?
What is array simple?