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
Is list a data structure?
State the difference between persistent and ephemeral data structure?
What are arrays used for?
Which interfaces are implemented by enumset?
What are the types of linked list?
Does treeset allow null?
What is homogeneous array?
What is the limit of arraylist?
Explain what are the types of collision resolution techniques and the methods used in each of the type?
Can arraylist be empty?
Write a Program for Linked list manipulation.
Write a program using mergesort technique.
Define general trees?
How does sort function work?
How does a selection sort work?