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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Why c++ is better than c language?

662


Is it possible for a member function to delete the pointer, named this?

709


What is void pointer in c++ with example?

676


Define 'std'.

717


What is an adaptor class in c++?

698






What is the best book for c++ beginners?

668


How can we read/write Structures from/to data files?

710


What is an undefined reference/unresolved external symbol error and how do I fix it?

701


Why is standard template library used?

678


Difference between strdup and strcpy?

757


What is the disadvantage of using a macro?

681


How do you show the declaration of a virtual constructor?

612


Is c++ high level programming language?

761


How do c++ struct differs from the c++ class?

701


List the issue that the auto_ptr object handles?

716