Binary Tree vs B TreeBefore understanding the differences between the binary tree and btree, we should know about binary tree and btree separately. What is Binary tree?A binary tree is a tree that contains at most two child nodes. The binary tree has one limitation on the degree of the node as node in a binary tree cannot contain more than two child nodes. The topmost node in a binary tree is known as a root node and node mainly consists of two sub trees known as left subtree and right subtree. If the node in a binary tree does not contain any children, then it is known as a leaf node. Thus, node can have either 0, 1 or 2 children. The operations that can be performed on a binary tree are insertion, deletion, and traversal. Binary tree can be categorized into following types:
It can be used to implement the expression evaluation, parsers, data compression algorithms, storing router-tables, cryptographic applications, etc. What is BTree?A btree is a self-balancing tree because its nodes are sorted in an inorder traversal. In contrast to binary tree, node in a btree can have more than two children. The height of btree is logMN where M is the order of tree and N is the number of nodes. The height of a btree adjusts automatically, and the height in a btree is sorted in a specific order having the lowest value on the left and the highest value on the right. Btree is mainly used to store huge amount of data that cannot fit in the main memory. When the number of keys increases then the data is read from the disk in the form of blocks. As we know that disk access time is more than the memory access time. The main idea behind using the btree is to reduce the number of disk accesses. Most of the operations that are implemented on btree like search, delete, insert, max, min, etc have O(h) disk accesses where h is the height of the tree. Btree is a very wide tree. The idea behind constructing the btree by keeping the height of the tree as low as possible by attaching the maximum number of keys in a btree node. The size of the btree node is mainly made equal to the disk block size. Since the height of the tree is quite low so disk accesses are reduced significantly as compared to the balanced binary search tree like AVL tree, Red Black tree, etc. Some important facts related to btree are given below:
![]() In the above figure, we can observe that all the leaf nodes exist at the same level, and all the non-leaf nodes are non-empty sub trees having keys one less than the number of their children. Let's understand the differences between binary tree and btree in a tabular form. ![]()
← prev
![]() Feedback
Help Others, Please Share![]() ![]() ![]() |