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
Is java as fast as c++?
What is c++ course?
What is pointer to array in c++?
What is the difference between while and do while loop?
Differentiate between declaration and definition.
What is istream c++?
What is long in c++?
What are the operators in c++?
How is data hiding achieved in c++?
What is command line arguments in C++? What are its uses? Where we have to use this?
What is #include iostream h in c++?
What are c++ manipulators?
What is dev c++ used for?
Is dev c++ free?
If a base class is an adt, and it has three pure virtual functions, how many of these functions must be overridden in its derived classes?