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

Close

You are in Guest Mode!

What you can do in guest mode:

  • Read the lessons
  • Watch the videos

What you can not do in guest mode:

  • Run your code
  • Submit your answers
  • Save your progress
  • View solutions
  • Get help from Boots
  • Take quizzes
  • Unlock achievements and roles

You're on assignment part 2/2 for this lesson.

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 BST has some additional constraints:

  1. Instead of an unbounded list of children, each node has at most 2 children
  2. The left child's value must be less than its parent's value
  3. The right child's value must be greater than its parent's value
  4. 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