make a middle node of doubly linklist to the top of the list



make a middle node of doubly linklist to the top of the list..

Answer / hussein

middle->prev->next = middle->next;
middle->next->prev = middle->prev;

// Now make the middle as head.
middle->prev = NULL;
middle->next = head;
head->prev = middle;
head = middle;

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C++ General Interview Questions

What are the advantages of using typedef in a program?

0 Answers  


Write a program to swap 2 chars without using a third varable? char *s = "A"; char *p = "B";

7 Answers   CTS,


Keyword mean in declaration?

0 Answers  


Write a note about the virtual member function?

0 Answers  


What are Binay tress and B trees? Diff between them?

8 Answers   CTS, GATE, Wipro,






Can member functions be private?

0 Answers  


class base { public: int fun(int) {} }; class base2 { public: int fun(float) { } }; so here qustion is both function either function overloading or over riding;

4 Answers   Manhattan,


Can constructor be private in c++?

0 Answers  


What is the difference between object-oriented programming and procedural programming?

0 Answers  


What are shallow and deep copies?

0 Answers  


Why the usage of pointers in C++ is not recommended ?

0 Answers   TCS,


Do class declarations end with a semicolon? Do class method definitions?

0 Answers  


Categories