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

Answer Posted / vijayan

struct node{
int data;
node * next;
};
node *pt1,*pt2=NULL:
while(root!=NULL)
{
pt1=root;
root=root->next;
pt1->next=pt2;
pt2=pt1;
}

Is This Answer Correct ?    31 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens if we try to insert duplicate key in hashmap?

417


What does adt stands for?

480


Write code for reversing a linked list.

517


What is a hash index?

472


What do you mean by an Array?

538






How to get largest and smallest number in an array?

530


Is binary tree a binary search tree?

479


What is a string array?

499


Where is data structure used?

538


What do you mean by 2-3-4 tree?

564


Tell me what should be done in the base case for this recursive problem?

480


What is a Breadth First Search? Give a few of its applications.

494


How does a heap sort work?

462


What is the logic to reverse the array?

480


What is difference between hashmap and hashset?

461