Introduction
In the previous set of notes we introduced the
multiway tree
and specifically the
variant known as an
mway search tree.
In this set of notes we will examine
several of the special variants of
mway search trees
that have important
applications in data structures.
24 Trees
If there is a maximum value
m
placed on the number of children that a given
node may have the tree is referred to as an
mway tree
.
In this section we will
focus on a common variant of the
mway tree
known as a
234 tree
or more
commonly as a
24 tree.
In the above definition, rule 1 defines a
size property
for the 24 tree; rules 2, 3,
and 4 define the
ordering property
(which identifies the tree as a search tree),
and rule 5 defines a
depth property
which determines the balance of a 24 tree.
This depth property ensures that the height of a 24 tree containing
n
key values
is
θ
(log
2
n).
Figure 1 shows a 24 tree containing 13 key values (items) with a
height of three (not counting the external nodes).
24 Trees 
1
Advanced Tree Structures –
2

4 Trees (10)
24 Tree
A 24 tree is an mway search tree
T
in which an ordering is imposed on
the set of keys which reside in each node such that:
1. Each node has a maximum of 4 children and between 1 and 3 keys.
2. The keys in each node appear in ascending order.
3.
The keys in the first
i
children are smaller than the
i
th key.
4.
The keys in the last
m1
children are larger than the
i
th key.
5. All external nodes have the same depth.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentFigure 1.
24 tree containing 13 key values.
Insertion into a 24 Tree
As with the other types of search trees that we have dealt with this semester,
insertion of a new item (
k, x)
, where
k
is the key value of item
x,
into a 24 tree
begins with a search for the key value
k
.
Assuming that the item does not
already exist, the search will terminate unsuccessfully at an external node, let’s
call it
z
.
If
v
is the parent of this external node
z
, then the new item is inserted
into node
v
and a new child is added to
v
.
Let’s call this new child
w
, and we
know that
w
is an external node.
While this insertion technique clearly
preserves the depth property of the 24 tree it may well violate the size property.
The problem is that node
v
may already have four children and thus be a
4
node
.
Insertion of a new node in this manner would cause node
v
to become a
5node and thus violate the size property.
Any time an insertion occurs in node which is already a 4node an
overflow
occurs and resolution of the overflow must occur to restore the properties of the
24 tree.
Resolution of the overflow is done via a
splitting
operation.
Recall that
we saw this operation when we examined the general
mway search tree
.
The definition of the split operation for a 24 tree is shown in Figure 2.
This is the end of the preview. Sign up
to
access the rest of the document.