# Difference between Binary tree and B-tree

• Difficulty Level : Basic
• Last Updated : 12 May, 2022

B-Tree : B-Tree is known as a self-balancing tree as its nodes are sorted in the inorder traversal. Unlike the binary trees, in B-tree, a node can have more than two children. B-tree has a height of logM N (Where ‘M’ is the order of tree and N is the number of nodes). And the height is adjusts automatically at each update. In the B-tree data is sorted in a specific order, with the lowest value on the left and the highest value on the right. To insert the data or key in B-tree is more complicated than binary tree.

There are some conditions that must be hold by the B-Tree:

• All the leaf nodes of the B-tree must be at the same level.
• Above the leaf nodes of the B-tree, there should be no empty sub-trees.
• B- tree’s height should lie as low as possible. Binary Tree : A binary tree is the special type of general tree. Unlike B-tree, in a binary tree a node can have at most two nodes. In a binary tree, there is a limitation on the degree of a node because the nodes in a binary tree can’t have more than two child node(or degree two). The topmost node of a binary tree is called root node and there are mainly two subtrees one is left-subtree and another is right-sub-tree. Unlike the general tree, the binary tree can be empty. Like B-tree, binary tree can also be sorted in inorder traversal. But it can also be sorted in preorder as well as postorder. In binary tree, data insertion is not complicated than B-tree. Let’s see the difference between B-tree and Binary tree:

My Personal Notes arrow_drop_up