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
Differentiate between a template class and class template in c++?
Which header file allows file i/o with streams a) fileio.h b) iostream.h c) fstream.h
Is c++ primer good for beginners?
Explain about vectors in c ++?
what is c++
Which bitwise operator is used to check whether a particular bit is on or off?
what is software cycle? What is a mission critical system ? What is the important aspect of a real-time system ? Explain the difference between microkernel and macro kernel. Give an example of microkernel.Why paging is used ? Which is the best page replacement algo and Why ? What is software life cycle ? How much time is spent usually in each phases and why Which one do U want to work if selected in Honeywell ? Which are the different types of testing ? What is a distributed system ? Some questions about CSP. Which languages do U know ? What are the differences between Pascal and C. questions from Compiler construction and Lisp. Which are the different computer architecture? What is the requirement in MIMD ? What is the difference between RISC and CISC processors ? Difference between loosely coupled and tightly coupled systems ? What is an open system?
Explain how to initialize a const member data.
. If employee B is the boss of A and C is the boss of B and D is the boss of C and E is the boss of D. Then write a program using the Database such that if an employee name is Asked to Display it also display his bosses with his name. For eg. If C is displayed it should also display D and E with C?
What is difference between class and function?
What is the best it certification?
Explain the use of virtual destructor?
Do we have to use initialization list in spite of the assignment in constructors?
What is an iterator class in c++?
Write a c program for binary addition of two 8 bit numbers.