Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

how to add an item to the beginning of the list?

967


What are the types of queues?

1084


What are the advantages of bubble sort?

956


Write a program to reverse a single linked list.

933


What does isempty() member method determines?

920


How to reverse a singly linked list?

1017


Define 2-3-4 tree?

885


Is null a binary search tree?

839


Can treemap have null values?

891


What are the advantages of array?

899


What is default size of hashmap?

896


Which interfaces are implemented by linkedhashset?

1022


What is the difference between array and stack?

1041


What is a list in data structure?

931


What is sequential sorting?

882