Question: How to create a copy constructor of a binary search tree with the given header file below. Using C++ (not C) with recursive: #ifndef BST_H_

How to create a copy constructor of a binary search tree with the given header file below. Using C++ (not C) with recursive:

#ifndef BST_H_ #define BST_H_ #include #include #include using namespace std; template class BST { private: struct Node { bstdata data; Node* leftchild; Node* rightchild; Node(bstdata newdata){ data = newdata; leftchild = NULL; rightchild = NULL; } }; Node* root;

void insertNode(Node* root, bstdata data);

//private helper function for insert //recursively inserts a value into the BS

void copyNode(Node* copy) const; //recursive helper function to the copy constructor

public: BST();

BST(const BST &bst); //copy constructor

void insert(bstdata data);

};

#endif /* BST_H_ */

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!