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

Which type of memory allocation is referred for linked list?

760


Explain the difference between a list and array.

541


List out the advantages of using a linked list?

498


What is harvesting in agriculture?

493


Explain Queue

642






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

543


What is concurrentlinkeddeque?

532


Is hashmap ordered?

533


Describe avl tree or height balanced binary search tree.

512


List the types of tree.

521


What is unmodifiable list?

511


Tell me why might quick sort might be better than merge sort?

497


We know that Arrays are objects so why cannot we write strArray.length()?

1101


What is the easiest sorting method to use in data structures?

552


Define 2-3-4 tree?

496