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 / kushal bagaria

struct node
{
int data;
struct node *list;
};

reverse(&p) /* p is the pointer to the 1st node of ll*/

function reverse:-

reverse(struct node **q)
{
struct node *r,*t,*prev;
r=*q;
prev= NULL;
while(r!=NULL)
{
t=prev;
prev=r;
r=r->link;
prev->link=t;
}
*q=prev; /* last node bcoms d root of ll */
}

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between list and map.

1072


Explain what are the types of collision resolution techniques and the methods used in each of the type?

971


What is arrays copyof?

919


How do you empty an arraylist?

1034


Why concurrenthashmap is fail safe?

1015


What is the advantage of the heap over a stack?

1059


How do you do binary search?

923


What is merge sort and how it works?

879


What are the different types of data structures?

1093


Is list an array?

884


What are the 3 types of measurement?

1090


What is the best complexity of bubble sort?

995


Can arraylist shrink?

953


An array having 100 elements have numbers from 1 to 99 randomly out of which any number is repeated. Find the repeated number in minimum time and space complexity.

1221


Why is merge sort faster?

947