create an singly linked lists and reverse the lists by
interchanging the links and not the data?

Answer Posted / vaishali naidu

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.
a.while(start!=curr)
{
prev->next=start
start->next=NULL;
start=prev;
prev=curr;
curr=curr->next;
}

Is This Answer Correct ?    13 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the prerequisite for binary searching?

770


Is vector synchronized?

686


Find duplicates in infinite range. Which data structure to be used to give efficient solution?

724


Advanced problems related to Data Structures were asked

701


Describe the complexity of Binary search

720


How do you do a mergesort?

658


Explain binary representation?

640


Does hashmap maintain insertion order?

679


List out the advantages of using a linked list?

642


How to sequentially represent max-heap?

685


What is a subtree in data structures?

702


Can you please explain the difference between string and an array?

715


How do you sort an arraylist in descending order?

610


What are the properties of binary tree?

684


Which interfaces are implemented by hashmap?

703