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
What are the classes in c++?
What type of question are asked in GE code writing test based on c++ data structures and pointers?
What is the return value of the insertion operator?
What is isdigit c++?
What jobs can you get with a c++ certification?
What is flush programming?
What is the purpose of the "delete" operator?
Should the this pointer can be used in the constructor?
What does obj stand for?
What is class in c++ with example?
What are features of c++?
what is a reference variable in C++?
If you push the numbers (in order) 1, 3, and 5 onto a stack, which pops out first a) 1 b) 5 c) 3
Is c++ built on c?
What are keywords in c++?