Skip to content

Latest commit

 

History

History
23 lines (13 loc) · 1.1 KB

File metadata and controls

23 lines (13 loc) · 1.1 KB

Challenge Summary

Built a Binary Tree and Binary Search Tree from the ground up

Challenge Description

Create a Node class that has properties for the value stored in the node, the left child node, and the right child node. Create a BinaryTree class Define a method for each of the depth first traversals called preOrder, inOrder, and postOrder which returns an array of the values, ordered appropriately. Any exceptions or errors that come from your code should be semantic, capturable errors. For example, rather than a default error thrown by your language, your code should raise/throw a custom, semantic error that describes what went wrong in calling the methods you wrote for this lab.

Create a BinarySearchTree class Define a method named add that accepts a value, and adds a new node with that value in the correct location in the binary search tree. Define a method named contains that accepts a value, and returns a boolean indicating whether or not the value is in the tree at least once.

Approach & Efficiency

Solution