Binary Search Trees
Our assumption in our simple Tree was that only leaves contain a value. This is not always true. In fact, there are different types of Tree with different utilities, and Binary Search Tree (BST) is one of them.
In computer science, BSTs, sometimes called ordered or sorted binary trees, are a particular type of container: data structures that store items (such as numbers, names, and so on) in memory. They allow fast lookup, the addition and removal of items, and implementation of either dynamic sets of items or lookup tables that allow finding an item by its key (for example, finding the phone number of a person by name).
BSTs keep their keys in sorted order so that lookup and other operations can use the principle of binary ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access