CSC230 Lab 10
Goal: This lab will teach you about tree operations.
Download the files from Canvas. There are three files in the contents. They are
treeNode.h, tree.h, and test.cpp.
In this lab, do NOT modify anything in treeNode.h and test.cpp. Your work is to
implement the methods in tree.h file. In the tree.h file, please implement the following
• treeBSearch(V x, TreeNode<V>* t)
• isLeaf(TreeNode<V>* t)
• height(TreeNode<V>* t)
• insert(V x)
After finishing the implementation, type the following command to compile the code.
where file test.cpp tests the implementations of the methods. The execution result of
The Tree Looks Like:
The tree is rooted at node 5.
Your implementation must have the exactly same result.
Requirements and Hints:
• The tree should be sorted, the values of left subtree are smaller than the root; the
values of the right subtree are larger than the root
• When you insert a node, pretend that you are searching the value, insert the node
to the place where it falls off the tree
Submit .cpp files to Canvas.