Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started