/binary_search_tree

Binary Search Tree Project Odin Project

Primary LanguageJavaScript

Binary Search Tree Project

Odin Project : Binary Search Tree

Requirements:
1. Node Class
2. Tree Class
     a. constructor should have a root attribute using the output of the buildTree function
     b. Array must be sorted and duplicates removed before tree is build
     c. buildTree() takes in an array and returns a balanced binary tree of Node objects
     d. prettyPrint() visualizes the tree in the console.log
     e. insert() creates and then inserts a node at a given point. Requires the tree to be rebalanced
     f. delete() deletes a given node from the tree. Requires the tree to be rebalanced
     g. find() find a node containing a given value and returns the index
     h. levelOrder() traverses the tree breadth first level
     i. inorder() traverse the tree inorder depth first
     j. preorder() traverse the tree preorder depth first
     k. postorder() traverse the tree postorder depth first
     l. height() returns the height of a given node. Height is the number of edges in the longest path from a given node to a leaf node
     m. depth() return the depth of a given node. Depth is the number of edges in path from a given node to the tree's root node
     n. isBalanced() check if a tree is balanced
     o. rebalance() rebalances an unbalanced tree