create an singly linked lists and reverse the lists by
interchanging the links and not the data?

Answer Posted / vimesh

struct node
{
int data;
node *link;
};
node *p=NULL;
void reverse(*x)
{
node *r,*s,*q;
r=NULL;
q=x
while(q->link!=NULL)
{
s=r;
r=q;
q=q->link;
r->link=s;
}
x=r;
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we insert null in set?

532


How do I rearrange rows in numbers?

522


What do you mean by recursive definition?

559


Which is faster arraylist or hashmap?

604


What does simulation of queues mean?

626






What are the advantages of linked list over array (static data structure)?

795


Tell me how to find middle element of linked list in one pass?

573


What data structure does a binary tree degenerate?

498


How to pass in data structure exam?

577


What do you mean by sorting?

507


How expression trees are gets represented in data structure?

556


Which collection is used for sort?

554


Is treeset thread safe?

552


What is a vector element?

530


Does mentioning the array name gives the base address in all the contexts?

853