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
Briefly explain recursive algorithm 50 how do you search for a target key in a linked list?
What is difference between hashmap and hashtable?
What are binary search and fibonacci search?
What is the complexity of adding an element to the heap?
Define primary data structures?
Is there any difference between int[] a and int a[]?
Can you tell me the differences between Array and ArrayList?
Is a hashset ordered?
Draw a binary Tree for the expression : A * B - (C + D) * (P / Q)
what is the difference between singly and doubly linked lists?
When would you use a hashmap?
How do treesets work internally?
How do you sort an array in decreasing order?
How does threaded binary tree represented in data structure?
What is difference between tree and binary tree?