Question: Below is a header file. Implement a cpp program that implements a BST using the header file below. Watch out for memory leaks as well.
Below is a header file. Implement a cpp program that implements a BST using the header file below. Watch out for memory leaks as well. It will be tested for memory leaks. such as its constructor, destructor, size, clear, insert, find, get leftmost node, successor (find and return the pointer to the successor of given node to the function) //header file below class binarysearchtree public: class node{ public: int data; node* leftchild,rightchild,parent; node(int d):data(d),leftchild(null),rightchild(null),pare nt(null) node* successor(); }; binarysearchtree(); ~binarysearchtree(); bool insert(int e); bool find(const int& f)const; node* getleftmostnode(); void clear(); unsigned int size(const; private: node * root; int numelements; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
