Notes

Search

Search IconIcon to open search

BST Tree Height

Last updated Dec 27, 2022

Height varies dramatically between “bushy” and “spindly” trees.

This means that for a bushy tree, we have to double the number of nodes to increase the height by 1. For a spindly tree, we have to add 1 node to increase the height by 1.

Importantly, Big-O and Theta notation are different. Big-O is less precise, and can be analogus to an inequality. If I say that a Binary Tree’s height is $O(n^{2})$, what I’m saying in english is

The height of a binary tree grows less than or equal to n^{2}

This is still true.

Whereas, if I say a binary tree’s height is $\Theta(log(n))$, what I’m saying in english is

The height of a binary trees grows equal to $log(n)$ in the best case ($n$ in the worst case).

Note that Big-O is still useful. In the real world, Big-O is shorthand for “in the worst case”.