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
Does hashmap sort automatically?
Write the algorithm for converting infix expression to postfix expression?
Which sorting is best and why?
Why do we need arrays if all the operations that are performed on arrays can be performed on arraylist?
Write an algorithm to show various operations on ordered list and arrays
Explain linear linked implementation of Stack and Queue?
What are the main differences between the linked list and linear array?
Define linear data structures?
Define linked list data structure.
Write the steps involved in the insertion and deletion of an element in the stack.
Define ancestor and descendant ?
What is binary tree in computer science?
Give us a program to reverse a linked list.
Which sorting does collections sort use?
What is faster array or arraylist?