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

What do you mean by Syntax Error

1001


Define adjacent nodes?

972


Differentiate between hashmap and hashtable.

1054


Define right-in threaded tree?

903


Explain what is linear search?

930


How treemap orders the elements if the key is a string?

860


What is the function of stack?

799


Which is best array or linked list?

859


List the area of applications of data structure.

1158


What is the space complexity of selection sort?

900


Model a data structure for a DFA that takes an event as parameter and performs a desired action.

1056


Run time memory allocation is known as in data structure?

893


How do you balance a tree?

910


What are the advantages of sorting?

875


What is a bubble sort and how do you perform it?

977