You are on page 1of 6

# COMPARISON BETWEEN BINARY TREE AND

B-TREE

## A binary tree is used when the records or data is

stored in the RAM instead of disk as the accessing
speed of RAM is much higher than the disk. On the
other hand, B-tree is used when the data is stored in
the disk it reduces the access time by reducing the
height of the tree and increasing the branches in
the node.
CON’T…

##  Another difference between the B-tree and the

binary tree is that B-tree must have all of its
child nodes on the same level whereas binary tree
does not have such constraint. A binary tree can
have maximum 2 subtrees or nodes whereas in
B-tree can have M no of subtrees or nodes where
M is the order of the B-tree.
CON’T…
CON’T…
 There are certain conditions that must be true for
a B-tree:
 The height of the tree must lie as minimum as
possible.
 Above the leaves of the tree, there should not be
any empty subtrees.
 The leaves of the tree must come at the same
level.
 All nodes should have least number of children
except leave nodes.
Properties of B-tree of order M
 Each node can have maximum M number of children and minimum M/2
number of children or any number from 2 to the maximum.
 Each node has one key less than children with maximum M-1 keys.
 The arrangement of the keys is in some specific order within the nodes.
All keys in the subtree present in the left of the key are predecessors of
the key, and that present in the right of the key are called successors.
 At the time of insertion of a full node, the tree splits into two parts, and
the key with median value is inserted at parent node.
 Merging operation takes place when the nodes are deleted.
CONT’N…

Conclusion
 The B-tree is used over binary and binary search
tree the main reason behind this is the memory
hierarchy where CPU is connected to cache with
the high bandwidth channels while CPU is
connected to disk through low bandwidth
channel. A binary tree is used when records are
stored in RAM (small and fast) and B-tree are
used when records are stored in disk (large and
slow). So, use of B-tree instead of Binary tree
significantly reduces access time because of high
branching factor and reduced height of the tree.