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 is the parent class of abstractqueue class?

588


List the two important key points of depth first search?

776


What is stack and its operations?

530


Write code for reversing a linked list.

615


What is the best case time complexity of bubble sort?

678






Can binary tree have 1 child?

582


What are binary search and fibonacci search?

596


List the basic operations carried out in a linked list?

733


Explain what are the types of collision resolution techniques and the methods used in each of the type?

585


What is bubble sort with example?

592


Which is faster binary or linear search?

558


How is a hashset implemented?

558


Is complete binary tree?

566


Explain binary representation?

555


Who invented merge sort?

559