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


Please Help Members By Posting Answers For Below Questions

What are the classes in c++?

630


What type of question are asked in GE code writing test based on c++ data structures and pointers?

3501


What is the return value of the insertion operator?

597


What is isdigit c++?

560


What jobs can you get with a c++ certification?

573






What is flush programming?

559


What is the purpose of the "delete" operator?

616


Should the this pointer can be used in the constructor?

543


What does obj stand for?

620


What is class in c++ with example?

559


What are features of c++?

622


what is a reference variable in C++?

647


If you push the numbers (in order) 1, 3, and 5 onto a stack, which pops out first a) 1 b) 5 c) 3

819


Is c++ built on c?

555


What are keywords in c++?

590