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

Why do we need sorting algorithms?

665


What is subtree?

675


Is hashmap part of collection?

645


What do you mean by separate chaining?

673


What is difference between data type and variable?

600






Explain the term base case?

675


Is char array null terminated?

630


Define dynamic data structures?

727


Does arraylist extend list?

619


What is the use of tree data structure?

631


What is the Difference between treemap and hashmap?

651


What is data type in data structure?

676


Which algorithm is used in arrays sort?

644


Which is faster binary or linear search?

628


Which is faster array or linked list?

620