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 a c++ vector?
What is the difference between strcpy() and strncpy()?
What is the basic structure of a c++ program?
how to explain our contribution in the project?
What programming language should I learn first?
Can I create my own functions in c++?
Assume an array of structure is in order by studentID field of the record, where student IDs go from 101 to 500. Write the most efficient pseudocode algorithm you can to find the record with a specific studentID if every single student ID from 101 to 500 is used and the array has 400 elements. Write the most efficient pseudocode algorithm you can to find a record with a studentID near the end of the IDs, say in the range from 450 to 500, if not every single student ID in the range of 101 to 500 is used and the array size is only 300
Explain the benefits of proper inheritance.
True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends
How does a C++ structure differ from a C++ class?
How long does it take to get good at leetcode?
Do the parentheses after the type name make a difference with new?
Define vptr.
How much is c++ certification?
What do you understand by zombie objects in c++?