Create a Node class
Create a BinaryTree class
Create a BinarySearchTree class
Authors: Emad Idris
BinaryTree should have these five different methods:
.preOrder()
()
Input: the binary tree the method is called on
Output: array of values using preOrder sort
.inOrder()
()
Input: the binary tree the method is called on
Output: array of values using preOrder sort
.postOrder()
()
Input: the binary tree the method is called on
Output: array of values using inOrder sort
.findMaximumValue(arr)
(takes in an array returned by one of the methods above)
Input: an array returned bypreOrder()
,inOrder()
orpostOrder()
Output: an integer with the maximum value found in the tree
.breadthFirst()
()
Input: the binary tree the method is called on
Output: array of values using breadth first, level order sort
BinarySearchTree should have these two different methods:
.add(value)
(adds a node withvalue
to the binary search tree)
Input: avalue
object to add to the binary tree at the proper location
Output: none
.contains(value)
(searches for avalue
in the binary search tree)
Input: avalue
to search for in the tree
Output: a boolean representing whether or not the value is in the tree
Write tests to prove the following functionality: