![]() |
AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
|
Simple implementation of 2-3-4-trees based on KTreeNode
.
More...
Simple implementation of 2-3-4-trees based on KTreeNode
.
Note that in contrast to BinarySearchTree
...
head
, there is no reference to parents. The class implements insertion with top-down and bottom-up splits. The strategy for splitting is selected at construction.
insert
calls the recursive insert_top_down
, which splits all 4-nodes (using split_top_down
) on the way down to the insertion position. (This may split the root!) So the final KTreeNode#insert
is guaranteed to not cause a split. insert
calls the recursive insert_bottom_up
, which inserts first and splits if the new node is a 5-node (recursive split_bottom_up
).KTreeNode
.) This has the side effect, that the selection of the node that is "pulled up" to the parent by KTreeNode#mergeChild
) possibly has to be "corrected" if the insertion position was less than 2.Note that there is currently no operation for removal. (This would cause KTreeNode#mergeChild
.)
Definition at line 38 of file A234Tree.java.