Site Search:

Binary Search Tree -- interactive



Node value:


Binary Search Tree is a 2 branch tree structure where left child node is smaller and right child node is bigger. This simple rule is applied anywhere in the tree -- from the root node to the leaf nodes. As a result navigating in a tree is also simple. At each node, we only have to decide go left, go right or get the job done, then delegate the task to the chosen node or report the result back to parent. This delegate chain will recursively find its way to the correct node to get the solid work done. The finished status then recursively reported back to the parent node, finally the root node gets update of all the changes happened inside the tree. The delegation passes down from root to leaf within logN steps, and the report passes up from leaf to root in logN steps as well, in theory, the height of N node binary tree most likely no taller than logN.

BST.java