how to do in place reversal of a linked list(singly or
doubly)?

Answer Posted / divakar & venkatesh

int reverse()
{
node *r,*s,*q;
s=NULL;
q=p;
while(q!=NULL)
{
r=q;
q=q->link;
r->link=s;
s=r;
}
p=r;
return;
}
this is reverse fun for single linked list.

Is This Answer Correct ?    7 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How are variables declared in c?

824


how to count no of words,characters,lines in a paragraph.

4136


What are the differences between new and malloc in C?

797


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

1817


What is wrong with this statement? Myname = 'robin';

1040


Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon

5686


Explain Function Pointer?

882


can we change the default calling convention in c if yes than how.........?

2274


explain what is a newline escape sequence?

861


What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

935


How to find a missed value, if you want to store 100 values in a 99 sized array?

1063


How can I manipulate individual bits?

784


Why & is used in c?

910


What is the sizeof () operator?

786


Can a pointer point to null?

781