Binary Tree In Data Structure

A Binary Tree is a type of tree data structure in which each node has at most 2 children nodes. The node on the left side of a parent node is called the left child and the node on the right side of the parent node is called the right child. In practice, we use the binary search tree which is a type of binary tree.

binary tree in data structure

Node Of A Binary Tree

The node of a binary tree consists of three components.

  • Data: It consists of the data part of the node.
  • Left: It contains a reference to the left child of the node
  • Right: It consists of reference to the right child of the node.

Types Of Binary Tree

There are five types of binary tree.

  1. Full Binary Tree
  2. Perfect Binary Tree
  3. Complete Binary Tree
  4. Balanced Binary Tree
  5. Degenerate Tree

Full Binary Tree

It is a binary tree in which each node has 0 or 2 children. In other words, each node except the leave has 2 children.

Full Binary Tree

Perfect Binary Tree

A perfect binary tree is a binary tree in which every internal node has 2 children and every external or leaf node is at the same level.

Perfect Binary Tree.png

Complete Binary Tree

A complete binary tree has all the levels filled except the last level where all nodes are as left as possible. Heap data structure uses a complete binary tree for its implementation.

Complete Binary Tree

Balanced Binary Tree

A balanced binary tree is a binary tree in which the difference between heights of left and right sub-trees is never more than one.

Balanced Binary Tree

Degenerate Tree

A tree which has a structure of a linked list. In this tree each internal node has a single child.

Degenerate Tree

Do you know?
Binary Tree In Data Structure This article is contribute by Kumar Shivam If you want share your knowledge on Study4Geeks then go to login section.