How many pointers are required to reverse a link list?
Answer Posted / vivek
# 3 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;
}
head_in_out = aNext; // Bug in above 3rd answer.
}
}
Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
There are 100 students in a class. The management keep information in two tables. Those two tables are given like Roll no Name Age 001 ABC 15 002 XYZ 14 and Roll No Subject Marks 001 Math 75 001 Physics 55 002 Math 68 001 Hindi 69 They want the information like this Roll No Name Hindi Physics Math Total 001 ABC 69 55 75 199 002 XYZ 68 74 84 226 And Roll No Suject Highest 001 Math 98 007 Physics 84 021 Hindi 74 All 275 All information is kept in structure in main memory. You have to find last two tables.
Explain shallow copy?
Describe protected access specifiers?
In which header file does one find isalpha() a) conio.h b) stdio.h c) ctype.h
How compile and run c++ program in turbo c++?
What are the differences between the function prototype and the function defi-nition?
Do you know about latest advancements in C++ ?
Which bit wise operator is suitable for putting on a particular bit in a number?
Which should be more useful: the protected and public virtuals?
What is the difference between public and private data members?
Write a program using display() function which takes two arguments.
What are the uses of typedef in a program?
How a new element can be added or pushed in a stack?
What are the methods of exporting a function from a dll?
What is dev c++ used for?