2. 2-3 Trees were developped by John hopcraft in 1974.
To keep the height of a binary search tree low, 2-3 trees were
developped.
A2-3 tree is a binary search tree that can have the following
nodes.
i) Leaf node
ii) 2-node
iii) 3-node
A 2-node contains a single data element (or) key element and it
has two children. X
L R
3. A 3- node contains two ordered Key elements (or) Data
Element and it has 3 children.
X | Y
L M R
3 -node
Two key elements are ordered i.e., x<y
4. Example of 2-3 tree:
40
25 65 | 85
20 35 55 70 95 | 102
Leaf nodes does not have child and one or two
data elements (or) key elements.
5. PROPERTIES
Every internal node is a 2-node or a 3-node.
Data or key elements are stored in sorted
order.
Each node has either one data value or two
data values.
Leaf nodes have no children and one or two
data elements or key elements.
6. Operation performed on 2-3 tree are:
i) Insert
ii) Delete
iii) Search
All the operations completed in o(logn)
time.
The time completely of 2-3 tree is o(log2n).