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

M-Way Search Trees

 

Definition (M-way Search Tree)  An M-way search tree    T is a finite set of keys. Either the set is empty, tex2html_wrap_inline62506; or the set consists of n M-way subtrees tex2html_wrap_inline62516, tex2html_wrap_inline62282, ..., tex2html_wrap_inline63238, and n-1 keys, tex2html_wrap_inline63242, tex2html_wrap_inline63244, ..., tex2html_wrap_inline63246,

displaymath63214

where tex2html_wrap_inline63248, such that the keys and nodes satisfy the following data ordering properties :

  1. The keys in each node are distinct and ordered, i.e., tex2html_wrap_inline63250 for tex2html_wrap_inline63252.
  2. All the keys contained in subtree tex2html_wrap_inline63254 are less than tex2html_wrap_inline63256. The tree tex2html_wrap_inline63254 is called the left subtree  with respect to the key tex2html_wrap_inline63256.
  3. All the keys contained in subtree tex2html_wrap_inline62338 are greater than tex2html_wrap_inline63256. The tree tex2html_wrap_inline63266 is called the right subtree with respect to the key tex2html_wrap_inline63256.

Figure gif gives an example of an M-way search tree for M=4. In this case, each of the non-empty nodes of the tree has between one and three keys and at most four subtrees. All the keys in the tree satisfy the data ordering properties. Specifically, the keys in each node are ordered and for each key in the tree, all the keys in the left subtree with respect to the given key are are less than the given key, and all the keys in the right subtree with respect to the given key are larger than than the given key. Finally, it is important to note that the topology of the tree is not determined by the particular set of keys it contains.

   figure17864
Figure: An M-way search tree.


next up previous contents index

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