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
Differentiate between list and map.
Explain what are the types of collision resolution techniques and the methods used in each of the type?
What is arrays copyof?
How do you empty an arraylist?
Why concurrenthashmap is fail safe?
What is the advantage of the heap over a stack?
How do you do binary search?
What is merge sort and how it works?
What are the different types of data structures?
Is list an array?
What are the 3 types of measurement?
What is the best complexity of bubble sort?
Can arraylist shrink?
An array having 100 elements have numbers from 1 to 99 randomly out of which any number is repeated. Find the repeated number in minimum time and space complexity.
Why is merge sort faster?