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

Answer Posted / bhanu yadav

reverse(node *first) //first address of first node in linked
{ node *x,*temp,*ttemp;
temp=first; //temp at first
ttemp=temp->next; //ttemp next to temp

while(temp->next!=null)
{ x=ttemp->next;
ttemp->next=temp;
temp=ttemp;
ttemp=x;
}
}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between list set and map?

476


Explain the Queue

575


What is circular queue example?

468


Define balancing condition for AVL Tree.

549


Define distributed query and linked server?

555






State the rules to be followed during infix to postfix conversions?

692


What is concurrentlinkeddeque?

532


How do you do a heap sort?

472


What is difference between arraylist and linkedlist?

542


Do you know how to find if linked list has loop?

638


What are hash tables good for?

465


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

517


Calculate the address of a random element present in a 2d array, given base address as ba.

1071


How do you sort an arraylist in descending order?

458


Can arraylist hold duplicates?

483