Branch Name: trees
Challenge Type: New Implementation
None. Not a whiteboard
-
Node
- Create a
Nodeclass that has properties for the value stored in the node, the left child node, and the right child node.
- Create a
-
Binary Tree
- Create a
Binary Treeclass.- Define a method for each of the depth-first traversals:
- Pre-order
- In-order
- Post-order
- Each depth-first traversal method should return an array of values, ordered appropriately.
- Define a method for each of the depth-first traversals:
- Create a
-
Binary Search Tree
- Create a
Binary Search Treeclass.- This class should be a sub-class (or your language's equivalent) of the
Binary Treeclass, with the following additional methods:Add- Arguments:
value - Return: nothing
- Adds a new node with that value in the correct location in the binary search tree.
- Arguments:
Contains- Argument:
value - Returns: boolean indicating whether or not the value is in the tree at least once.
- Argument:
- This class should be a sub-class (or your language's equivalent) of the
- Create a