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 are linked lists most commonly used for?

492


What is the purpose of sorting algorithms?

512


In tree construction which is the suitable efficient data structure?

555


What is an recursive algorithm?

527


How null key is handled in hashmap?

469






Why is selection sort used?

497


Define separate chaining?

550


What is the best case complexity of quicksort?

520


What is height balanced tree?

506


Is priority queue sorted?

517


What are the different types of data type?

535


What are different techniques for making hash function? Explain with example.

553


What is the time complexity of arrays sort?

471


What are data members?

519


What is the similarity between a Structure, Union and enumeration?

580