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 is the difference between map and hashmap in c++?
Why c++ is called oop?
Can c++ be faster than c?
What is the use of 'this' pointer?
Is map sorted c++?
What is atoi?
Which coding certification is best?
What do you mean by public protected and private in c++?
What is size_type?
What is a stack c++?
What is pure virtual function?
What is the basic concept of c++?
What are c++ stream classes?
Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.
Write a function to find the nth item from the end of a linked list in a single pass.