Cover Data Structures and Algorithms with Object-Oriented Design Patterns in Java
next up previous contents index

Constructor and attachSubtree Methods

Program gif defines a constructor that takes a single int argument M and creates an empty B-tree of order M. By default, the parent field is null.

The attachSubtree method is used to attach a new subtree to a given node. The attachSubtree routine takes an integer, i, and an M-way tree (which must be a B-tree instance), and makes it the tex2html_wrap_inline57340 subtree of the given node. Notice that this method also modifies the parent field in the attached node.


next up previous contents index

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