Logo Data Structures and Algorithms with Object-Oriented Design Patterns in C++
next up previous contents index

Binary Search Trees

The class BST declared in Program gif represents binary search trees. Since binary trees and binary search trees are topologically similar, the BST class is derived from the BinaryTree class given in Section gif. In addition, because it represents search trees, the BST class is also derived from the SearchTree class.

   program19333
Program: BST Class Definition

As shown in Program gif the BST class inherits much of its functionality from the BinaryTree base class. However, several functions are overridden, including AttachKey, DetachKey, Left and Right. In addition a new function, Balance, has been added to the protected interface. The purpose of this function is to support the AVL class discussed in Section gif.




next up previous contents index

Bruno Copyright © 1997 by Bruno R. Preiss, P.Eng. All rights reserved.