Binary search trees implemented with JavaScript
buildTree(array)
takes an array of data and turns it into a balanced binary tree full ofNode
objects appropriately placedinsert(value)
adds a new node containing the given valuedelete(value)
deletes the node containing the given valuefind(value)
returns the node with the given valuelevelOrder()
traverses the tree in breadth-first level orderinorder()
traverses the tree in inorder depth-first orderpreorder()
traverses the tree in preorder depth-first orderpostorder()
traverses the tree in postorder depth-first orderheight(node)
returns the height of the given nodedepth(node)
returns the depth of the given nodeisBalanced()
checks if the tree is balancedrebalance()
rebalances an unbalanced tree