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

Answer Posted / mayur bagal

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

node *pt2=NULL:
while(root!=NULL)
{
node * temp = root->next;
root->next= pt2;
pt2=root;
root = temp;
}

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is doubly linked list in data structure?

439


What do you mean by separate chaining?

522


Treemap orders the elements on which field?

522


How do I sort hashset?

501


Can arraylist hold duplicates?

492






Are duplicates allowed in hashmap?

496


Which sorting algorithm is used in arrays sort?

504


Name some applications which use linked lists.

552


Explain extended binary tree.

517


Why do we use collections?

483


How to use appendNode() in linkedlist()?

666


Construct a doubly linked list using a single pointer in each node?

550


Define indegree of a graph?

682


What is array sort?

512


What’s the difference between enumeration and iterator interfaces?

516