how to do in place reversal of a linked list(singly or
doubly)?
Answer Posted / ashish gupta
rev()
{
struct node *a1,*a2,*a3;
if(start->next==NULL) /*Only one element exists*/
return;
a1=start;
a2=a1->next;
a3=a2->next;
a1->next=NULL;
a2->next=a1;
while(a3!=NULL)
{
a1=a2;
a2=a3;
a3=a3->next;
a2->next=a1;
}
start=a2;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
Differentiate between a for loop and a while loop? What are it uses?
Can i use “int” data type to store the value 32768? Why?
Is c++ based on c?
Differentiate between null and void pointers.
How can I prevent another program from modifying part of a file that I am modifying?
How can I rethow can I return a sequence of random numbers which dont repeat at all?
Can a variable be both static and volatile in c?
What are data structures in c and how to use them?
Is c still relevant?
Why main function is special give two reasons?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
Explain is it valid to address one element beyond the end of an array?
Can you please explain the difference between malloc() and calloc() function?
Do you have any idea how to compare array with pointer in c?