Note: There is no lab 5. The weightings of labs and programming assignments will be adjusted to account for the missing 4%.
Copy the file
Use the program in interactive load mode to enter data (small integers, no duplicates) such that you produce three trees of the following shapes:
In a written statement, discuss the relationship between the order in which data items arrive for insertion into a tree and the shape of the resulting tree. Specifically, identify orders that lead to a worst-case tree (from the perspective of searching for data) and a best-case tree. Explain why these orders result in the best and worst cases respectively.
Extend the loadTree function to allow a fourth option: "Load a Best-Case Tree". Write a new function loadBestCaseTree() which is called when the user selects this new option. The new function should inquire how many items the user wants in the tree (N) and then generate calls to the add method that result in a completely full binary search tree containing the values 1, 2, ... N. Confirm that your function works by printing a tree that results from calling it.
Submit a lab report which includes your answers to the questions posed in Part 1 and the printout of the tree specified in Part 2, along with the changed portion of the source code.
E-mail a copy of your revised Treesrch.cpp to mohrj@augustana.ab.ca.