Binary search tree are organized:
BST node: key = k*
/ \
Tleft Tright
k≤k* k*≤k
Lets call k* the pivot. The text does not use this terminology, I have made it up for now. The pivot organizes the key below the node by keys less than or greater then the pivot value. For a binary tree each node has only one pivot because there are only two sub-trees.
Multi-way search trees have 2 or more children and store entries = (k, x), key and value pair.
v is a node of an ordered tree.
v is a d-node
if v has d children
The ordered tree, T, is a multi-way search tree iff
All internal nodes v are d-node with d ≥ 2
Each d-node v of T with children v1, v2, ... vd stores d-1 items (k1, x1), (k2, x2), ..., (kd-1, xd-1), where k1 ≤ k2 ≤...≤ kd-1. Note one less entry then children.
Let k0 = -inf and kd = inf then for each entry stored in the subtree of the d-node v rooted at vi, i=1,...,d; ki-1≤ k ≤ ki. Note this is just the generalization of the binary search tree ordering to multi-way trees. See below.
If we continue to call the keys stored at a node of a multi-way tree pivots, then the search tree can still be organized by the pivots:
d-Node: keys: k1 ≤ k2 ≤ k3 ≤... ≤ kd-1
/ | | \
T1 T2 ... Td-1 Td
k≤k1 k≤k2 k≤kd-1 kd-1≤k
We see that the number of sub-trees, children, of a node is one more then the degree of the node, the number of pivots, entries, of the node.
Again external nodes are place holders and can be programed away.
Proposition
A multi-way tree storing n entries
has n + 1 external nodes.
This is just like for binary trees.
At each internal node a multi-way search tree, T, with v at each internal node of T. The entries stored at an node may be contained in a:
List
Sequence
Tree
etc.
It is a good idea for the container ot be an ordered dictionary. The multi-way tree is a compound data type, divided into primary and secondary data structure. In this case a dictionary of dictionaries.
We store at d-node v of T the items (k1, x1, v1), (k2, x2, v2), ... , (kd-1, xd-1, vd-1), (inf, null, vd). This gives us access to the children. Note that vi is a reference to the sub-tree root node.
Searching for key, k, in search tree T we process a d-node v.
We find the smallest key among the d keys stored at v such that ki ≥ k.
if k < ki then continue the search in the dictionary of vi.
else k = ki then the search terminates.
The space requirement is O(n).
The time spent searching is dependent on the secondary structure. Say the primary structure, the multi-way tree, has height h. Say dmax is the maximum d-node size. If the secondary structure is ordered structure then the search through the secondary structure is O(lg dmax) and the total search is O(h lg dmax). If the secondary structure is unordered dictionary then the search through the secondary structure is O(dmax) and the total search is O(h dmax).