Binary Search Tree (BST)

nico1as.eth
1 min readJun 30, 2022

--

-

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.

Binary Search 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.

--

--

nico1as.eth

菜雞的投資想法、閱讀心得、幣安校園大使、前端網頁製作