Representation of Binary Tree
Each node of a binary tree has the following 3 parts:
- Data
- Pointer to left child node
- Pointer to right child node
To create a binary tree, we have to first create a node having a data, pointer to left child and pointer to right child using the below structure format:
struct node
{
int data;
struct node *left;
struct node *right;
};
To learn more about binary tree refer: Introduction to Binary Tree – Data Structure and Algorithm Tutorials
Binary Tree in C
A binary tree is a non-linear hierarchical data structure in which each node has at most two children known as the left child and the right child. It can be visualized as a hierarchical structure where the topmost node is called the root node and the nodes at the bottom are called leaf nodes or leaves.
In this article, we will learn the basics of binary trees, types of binary trees, basic operations that can be performed on binary trees as well as applications, advantages, and disadvantages of binary trees in C.
Contact Us