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
Difference between Shallow copy and Deep copy?
What is the difference between union and anonymous union?
Give the rules for variable declaration?
Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.
Should I learn c before c++?
Why should I prototype a function?
Explain what is #line used for?
What is the use of define in c?
When should a type cast not be used?
When should a type cast be used?
What are logical errors and how does it differ from syntax errors?
how is the examination pattern?
What are disadvantages of C language.
What is the purpose of void pointer?
Explain what does it mean when a pointer is used in an if statement?