create an singly linked lists and reverse the lists by
interchanging the links and not the data?
Answer Posted / kushal bagaria
struct node
{
int data;
struct node *list;
};
reverse(&p) /* p is the pointer to the 1st node of ll*/
function reverse:-
reverse(struct node **q)
{
struct node *r,*t,*prev;
r=*q;
prev= NULL;
while(r!=NULL)
{
t=prev;
prev=r;
r=r->link;
prev->link=t;
}
*q=prev; /* last node bcoms d root of ll */
}
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
State the rules to be followed during infix to prefix conversions?
What do you mean by secondary clustering?
Explain multiply linked list in short.
Why would you use a linked list?
What is example of data?
How is bubble sort done?
Define probing?
Explain the uses of binary tree.
How to reverse singly link list?
What is the use of tree data structure?
What are the applications of priority queues?
What are the properties of binary tree?
Explain how is linked list implemented?
Which method will arrange the element of an array in alphabetical order?
Explain merge sort algorithms.