A binary tree is a tree that has at most two children for any of its nodes. There are several types of binary trees. To learn more about them please refer to the article on “Types of binary tree“
Application of Binary Trees:
- Huffman coding tree is an application of binary trees that are used in data compression algorithms.
- In compilers, Expression Trees are used which are applications of binary trees.
- Priority Queue is another application of binary tree that is used to search maximum or minimum in O(log N) time complexity.
Real-time applications of Binary Trees:
- DOM in HTML.
- File explorer.
- Used as the basic data structure in Microsoft Excel and spreadsheets.
- Evaluate an expression
- It is used to implement indexing of segmented databases.
Advantages of Binary Tree:
- The searching operation in a binary tree is very fast.
- The representation of a binary tree is simple and easy to understand.
- Traversing from a parent node to its child node and vice-versa is efficiently done.
Disadvantages of Binary Tree:
- In binary tree traversals, there are many pointers that are null and hence useless.
- The access operation in a Binary Search Tree (BST) is slower than in an array.
- Deletion of nodes in a binary tree is a complex task to be performed.