Question
c++ language. Doubly Linked List. recursively create a copy of the source list with head. newhead is the head of the destination list. //This is
c++ language. Doubly Linked List.
recursively create a copy of the source list with head. newhead is the head of the destination list.
//This is the function. Note : it is okay to make more functions.
void duplicate(node *& newHead) const
//This is the header file . //Notice that there is a head and a tail pointer!!! #include
struct node { int data; node * previous; node * next; };
class list { public: //These functions are already written list(); //supplied ~list(); //supplied void build(); //supplied void display(); //supplied
/* *****************YOUR TURN! ******************************** */ /* place your prototype here */ private: node * head; //notice there is both a head node * tail; //and a tail, common for DLL };
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started