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...

how to do in place reversal of a linked list(singly or
doubly)?

Answer Posted / ashish gupta

rev()
{
struct node *a1,*a2,*a3;
if(start->next==NULL) /*Only one element exists*/
return;
a1=start;
a2=a1->next;
a3=a2->next;
a1->next=NULL;
a2->next=a1;
while(a3!=NULL)
{
a1=a2;
a2=a3;
a3=a3->next;
a2->next=a1;
}
start=a2;
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

2139


Differentiate between a for loop and a while loop? What are it uses?

1189


Can i use “int” data type to store the value 32768? Why?

1192


Is c++ based on c?

1075


Differentiate between null and void pointers.

1176


How can I prevent another program from modifying part of a file that I am modifying?

1062


How can I rethow can I return a sequence of random numbers which dont repeat at all?

1192


Can a variable be both static and volatile in c?

1044


What are data structures in c and how to use them?

1174


Is c still relevant?

1088


Why main function is special give two reasons?

1548


any "C" function by default returns an a) int value b) float value c) char value d) a & b

1087


Explain is it valid to address one element beyond the end of an array?

1221


Can you please explain the difference between malloc() and calloc() function?

1126


Do you have any idea how to compare array with pointer in c?

1053