Question: Consider the following BST class definition for a Binary Search Tree data structure. This BST is different (from the textbook explanation) in that it removes
Consider the following BST
templatestruct Node { Node(const T& v) : m_val(v), m_act(true), m_left(0), m_right(0) {} T m_val; bool m_act; Node * m_left; // pointer to the left subtree. Node * m_right; // pointer to the right subtree. }; template class BST { public: BST(); BST(const BST&); void operator=(const BST&); ~BST(); bool remove(const T&); void insert(const T&); bool is_member(const T&) const; long size() const { return m_active; } void compress(); // removed all marked nodes. Bag sort() const; // produce a sorted Bag. private: Node * m_root; long m_active; // count of active nodes. long m_inactive; // count of inactive nodes. };
To test your implementation, produce the following main program using your implementation of BST
Generate 300 student records randomly into a Bag
Generate 500 students randomly into a Bag
Use ssid field for the search key of the student record. Bag
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
