CSCI 200 - Foundational Programming Concepts & Design - Fall 2022

Lab XC - Binary Search Trees

This lab is due by Thursday, December 08, 2022, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.


The BinarySearchTree Class


We are going to now make a new templated class called BinarySearchTree. This will necessitate creating a new struct for a TreeNode to store the parent, left, and right pointers.

The BinarySearchTree class needs to have the following public methods created:

To test your implementation, perform in main.cpp the following steps in order:

  1. Create a BinarySearchTree of integers
  2. Add the value 6
  3. Add the value 5
  4. Add the value 7
  5. Add the value 1
  6. Add the value 2
  7. Add the value 9
  8. Add the value 3

You'll verify your insert() is working correctly in the corresponding assignment.


Lab Submission


Submit your BinarySearchTree.hpp, TreeNode.hpp, main.cpp, Makefile file(s).

You will submit your solution to this lab with the rest of SetXC. Detailed instructions for doing this are posted in Assignment XC.


This lab is due by Thursday, December 08, 2022, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.