Skip to main content

Binary search tree

A binary search tree keeps smaller keys in the left subtree and larger keys in the right subtree. A search starts at the root and moves left or right after each comparison.

In the picture

  1. Root disc: the first key compared
  2. Left thread: the search moves left because the target key is smaller
  3. Left child disc: the next key compared
  4. Lower-left disc: a leaf key at the end of the glowing trail

Examples

  • Looking up a word in a printed dictionary
  • Following choices in a video-game skill tree

Quiz: Binary search tree (Age 17)

  1. In a binary search tree, where are keys smaller than a node found?

    • In that node’s right subtree
    • In that node’s left subtree
    • Only at the root
  2. During a binary search tree search, what determines whether you move left or right after comparing the target with a node?

    • Whether the target key is smaller or larger than the current node
    • Whether the search has already visited the left child
    • Whether the current node is the root or a leaf
  3. What does each comparison discard during a binary search tree search?

    • Every key at the same depth
    • One whole side of the tree
    • Only the current node

The answers, each with its explanation, are in the app. This lesson has left the free week, so its quiz is part of the subscription.

Get the app

Free app, optional subscription
App Store Google Play

Carry on in the app

At least one new illustrated lesson every weekday for your child’s year, with its quiz and a reminder at 6:15 pm.

Your child’s teacher does not use My Enhanced Teacher yet?

Tell them about it

Technology, Age 17