next up previous contents
Next: Building binary search trees Up: Binary search trees Previous: Binary trees (of integer   Contents

Binary search trees

This is a solution to our problem: We will consider how to store our data using a binary tree such that searching for a particular item takes a minimal effort. The underlying idea is simple: At each node, we want the value of this node to tell us whether we should search in the corresponding left or right subtree. Hence we define:




Definition.A binary search tree is a binary tree that is either empty or satisfies the following conditions:

An example is given in Figure 2.1.



Martin Escardo 2005-01-11