ProLesson 3 of 37 min read

Binary search trees: how they find a value

Understand the ordering rule of a binary search tree and follow, step by step, how it searches by halving the possibilities.

A dictionary finds a key fast, but it does not keep keys in sorted order. A list can be sorted, but inserting into the middle is slow. A binary search tree (BST) aims for both: it keeps values in order and lets you find, add or remove values quickly, as long as the tree stays reasonably balanced.

Vidi Pro

Keep going with Pro.

The first lesson of every class is free. Pro opens every lesson in IELTS, Programming, Mathematics, Science and Data and AI, with practice questions.

Already have Pro? Log in to keep reading.

Written with AI help. Spotted a mistake? Tell us.