- Every node of Binary Tree can contain at most two child,means every node can contain 0 ,1 or 2 child.
- Empty tree is also comes under the Binary Tree.
- Root of binary Tree contains the address of the left subtree and right subtree.
- There are some variations of binary tree , Example :
1- Types of Binary Tree
Binary Tree also have a lot of its category :
1.1 – Strict Binary Tree :
If each node of a binary tree contain exactly two or zero children ,is called Strict binary tree.
- B has exactly two child node D and E.
- D,H and G has exactly zero child or no child.
- E has exactly two child.
1.2 – Full Binary Tree :
If each node of a binary tree contain exactly tow child node.this types of binary tree is called Full Binary tree.In Full binary tree all Leaf node will be at same level.
- Here every node is having exactly two child node.
1.3 – Complete Binary Tree :
if leaf nodes of tree are situated at height h or at h-1 ,then this type of binary tree is called Complete binary tree.
- Here Leaf node D is present at h-1 height.
- Leaf node H is also present at h height.
2-Node Structure of Binary tree
- Binary Tree node contain three fields :
1- field for left subtree.
2- field for DataElement.
3- field for right subtree. - In C & C++ ,we can use structure to implement the Binary tree :
struct binaryTreeNode
{
int DataElement;
struct binaryTreeNode* left;
struct binaryTreeNode* right;
}
3-Operations of Binary Tree
There are some important operations ,which can be apply on Binary tree:
- Traversal : visiting on the every node at least once.
- Insertion : Addition of a node.
- Deletion : Removal of a node.
4-Applications of Binary Tree
- Representation of Mathematical expression of compilers is done with the binary tree.
- binary tree use to implement some tree type data structure like Binary Search tree and Priority Queue.