If we want to find out whether a given object is present in a binary search tree, we can proceed as follows. Suppose the item is the number 39. Beginning at the root of the tree, we see that 39 is greater than 21, so that if 39 is present in the tree, it must occur in the right hand sub-tree because of the (S) property. Since 39 is less than 40, it must occur in the left-hand sub-tree of the tree rooted at 40. We next compare 39 with 31, move to the right and finally compare 39 with 35. Since 39 is greater than 35, it must occur in the right hand sub-tree of the tree rooted at 35, if it occurs at all. But the right-hand sub-tree at 35 is empty, and nothing occurs in the empty tree. We have therefore established that 39 is not present in the tree.
Note that all the comparisons made occurred on a path through the tree, beginning at the root and ending at one of the leaves. For efficiency, binary search trees are much more useful if they are balanced. This means that the path lengths from the root node to each of the leaf nodes are roughly the same. The tree shown above is not as well balanced as it could be. The same data could just as well be stored in the balanced tree