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

Answer Posted / bhanu yadav

reverse(node *first) //first address of first node in linked
{ node *x,*temp,*ttemp;
temp=first; //temp at first
ttemp=temp->next; //ttemp next to temp

while(temp->next!=null)
{ x=ttemp->next;
ttemp->next=temp;
temp=ttemp;
ttemp=x;
}
}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is binary tree and its properties?

463


What do you know about traversal in linked lists?

481


What do you mean by breadth first search (bfs)?

616


What are the advantages and disadvantages of linked list?

430


What is a hash in programming?

495






What is a simple graph?

531


What is a directed graph?

555


How do you do a selection sort?

500


What is the best case complexity of quicksort?

517


How can you insert a node to the beginning of a singly linked list?

509


What is a binary search tree? Explain with example?

509


What is stable sort example?

506


Is list a data type?

500


Will arraylist maintain insertion order?

503


How do you find the time complexity of a bubble sort?

488