B Trees
B Trees
B trees are extended binary search trees that are specialized in m-way searching,
since the order of B trees is 'm'. Order of a tree is defined as the maximum number
of children a node can accommodate. Therefore, the height of a b tree is relatively
smaller than the height of AVL tree and RB tree.
They are general form of a Binary Search Tree as it holds more than one key and
two children.
B trees are also widely used in disk access, minimizing the disk access time since
the height of a b tree is low.
Note − A disk access is the memory access to the computer disk where the
information is stored and disk access time is the time taken by the system to
access the disk memory.
Insertion operation
The insertion operation for a B Tree is done similar to the Binary Search Tree but
the elements are inserted into the same node until the maximum keys are reached.
The insertion is done using the following procedure −
Another hiccup occurs during the insertion of 11, so the node is split and median is
shifted to the parent.
While inserting 16, even if the node is split in two parts, the parent node also
overflows as it reached the maximum keys. Hence, the parent node is split first and
the median key becomes the root. Then, the leaf node is split in half the median of
leaf node is shifted to its parent.