Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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 #include #include #include using namespace std;

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

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions