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
What are linked lists in c?
What is define c?
What are directives in c?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
Why c is called a middle level language?
What is #include conio h?
Is c++ based on c?
a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if
Can we assign integer value to char in c?
What is the use of header files?
How do you print an address?
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
Does * p ++ increment p or what it points to?
Can we add pointers together?