We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Binary Trees

Trees aren't particularly useful data structures unless they're ordered in some way. One of the most common types of ordered tree is a Binary Search Tree or BST.

A binary tree node has at most 2 children. A BST adds a few more constraints:

  1. The left child's value must be less than its parent's value
  2. The right child's value must be greater than its parent's value
  3. No two nodes in the BST can have the same value

By ordering the tree like this, we can traverse the tree to find the node we want much faster.

Click to play video