Binary Search Tree
Age 18 · Computer Science
Each node stores a key. A smaller key always hangs to the left of its parent, and a larger key hangs to the right, so a search follows one downward branch.
This picture is part of the full library
Every lesson is open to everyone for 7 days after it is published. This one came out on October 12, 2026: its text stays readable here, and its picture opens with a subscription.
The app is free. A subscription opens every lesson, in every school year.
In the picture
- The top ball: the root key where a search begins
- The down-left ball: a key smaller than its parent
- The down-right ball: a key larger than its parent
- The glowing stick: the chosen branch taken at the root
- The glowing bottom ball: the key reached after one branch at each step
Examples
- Finding a contact by name in a phone app by comparing and following one branch.
- Locating a product by its ID in an online store by going left or right.
Key takeaways
- Each left subtree contains only smaller keys.
- Each right subtree contains only larger keys.
Quiz: Binary Search Tree (Age 18)
-
In a binary search tree, what does a node’s left subtree contain?
-
Where does a search in a binary search tree begin?
-
During a search in a binary search tree, how does the search move through the tree?
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.
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