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
Can binary tree have 1 child?
Differentiate between iterator and listiterator.
What is the default capacity of hashmap?
What is bubble sort technique?
Which is more efficient merge sort vs quicksort?
Define shortest path?
What is raid (redundant array of inexpensive disks)?
write a program to show the insertion and deletion of an element in an array using the position
What is meant by hashing?
Why is arraylist faster than linkedlist?
What is quick sort?
What is nonlinear data?
how to display Singly Linked List from First to Last?
What are the two types of data?
Is array of data structure?