Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Binary Search Tree (BST)

A Binary Search Tree is a type of Binary Tree, where each node has a value greater than all nodes in its left subtree and less than all nodes in its right subtree. This applies to all nodes in the tree.

Compared to a standard Binary Tree, a BST has a logarithmic time complexity for searching, inserting and deleting. This is true if the BST is balanced. In fact, for an unbalanced one, we are going to have a linear time complexity as for a normal Binary Tree.