How many pointers are required to reverse a link list?
Answer Posted / vivek
using 2 pointer:
void reverse(node* head_in_out)
{
if(head_in_out)
{
node* aCurr = head_in_out;
node* aNext = NULL;
while (aCurr)
{
head_in_out = aCurr->next;
aCurr->next = aNext;
aNext = aCurr;
aCurr = head_in_out;
}
}
}
Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Specify some guidelines that should be followed while overloading operators?
What is ios :: in in c++?
What is the purpose of ios::basefield in the following statement?
Explain how would you handle a situation where you cannot call the destructor of a local explicitly?
What does the linker do?
What is difference between c++ and c ++ 14?
Is eclipse good for c++?
write a programme to get a character and thier ASCII value
What is an iterator class in c++?
Differentiate between declaration and definition.
If dog is a friend of boy, is boy a friend of dog?
Is c++ platform dependent?
What are advantages of using friend classes?
What are the two types of polymorphism?
What are member functions used in c++?