Binary Search Tree (BST)
-
Binary Search Tree is a kind of data structure, which consists of multiple nodes and each node has the utmost of two subnodes.
There are two significant features of binary search tree.
First and foremost, the value of each node in binary search tree is larger than its left connected nodes.
Secondly, the value of each node is lower than its right connected nodes.
Accordingly, the lowest value of binary search tree can be found by tracing from root node to the left end of the tree.
Similarly, the largest value of tree can be found by tracing from root node to the right end the tree.
Above is the implementation of using javascript to insert and find value.
Deletion in Binary Search Tree is quite complicated to understand, and it is better to understand DFS (Depth First Search) first before jumping into delete nodes in BST.