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

Explain circular linked list?

967


What are the applications of b-tree?

1027


What is the idea behind splaying?

1836


Are sets sorted?

952


Different Types of pattern?

1018


Which sorting algorithm is the slowest?

894


How do I sort hashset?

952


Why it is important to have aligned addresses? What is the exception generated when there is a misaligned address?

956


Is treemap thread safe?

930


What is the best case time complexity of bubble sort?

1089


What is vector and types of vector?

1113


How would you reverse characters of an array without using indexing in the array.

941


What is sequential search? What is the average number of comparisons in a sequential search?

840


What is faster array or arraylist?

953


Why sorting is done?

920