Question: Implement class Set using a binary search tree by modifying the textbook BinarySearchTree class (Figures 4.16, 4.17, 4.18, 4.20, 4.21, 4.23, 4.26, 4.27, and 4.28)

Implement class Set using a binary search tree by modifying the textbook BinarySearchTree class (Figures 4.16, 4.17, 4.18, 4.20, 4.21, 4.23, 4.26, 4.27, and 4.28) as follows: 
 1) Add data member Size.
 2) Add nested classes const_iterator and iterator with the same members as those of Figures 3.14 and 3.15. 
 3) Add methods begin() and end(). 
 4) Add to each node a link to the parent node. (This is needed by operator++ in the iterators.) Include a main function that instantiates a set of integers, Set, and allows an interactive user to execute any of the member functions and to print the contents of the set using an iterator (Figure 3.6).  
Include error checks and comments as always.

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!