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 do you mean by late binding?
Explain the use of virtual destructor?
Can we define function inside main in c++?
Why is "using namespace std;" considered bad practice?
How many standards of c++ are there?
What are all predefined data types in c++?
How to demonstrate the use of a variable?
What is a syntax in c++?
What is class invariant in c++?
What are shallow and deep copies?
Explain how the virtual base class is different from the conventional base classes of the opps.
What operators can you overload in c++?
What is a class template in c++?
What's the best free c++ profiler for windows?
Which software is best for programming?