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
Which is faster list or set?
What sort of serious problems have you experienced, and how have you handled them?
Is a hashset ordered?
Can arraylist be resized?
What is complete binary tree in data structure?
What is the difference between static and dynamic data?
Is hashmap faster than arraylist?
How do arrays work?
Why might quick sort might be better than merge sort?
What is dynamic array how is it created?
In rdbms, explain what is the efficient data structure used in the internal storage representation?
When will you use array over arraylist?
In depth questions regarding the data structures and the Databases used in the Projects developed.
Differentiate between file and structure storage structure.
How does threaded binary tree represented in data structure?