Types of Trees (original) (raw)

Last Updated : 13 Jan, 2026

A tree is a hierarchical data structure that consists of nodes connected by edges. It is used to represent relationships between elements, where each node holds data and is connected to other nodes with edges.

tree

1. Binary Tree

A binary tree is a tree data structure where each node has at most **two children. These two children are usually referred to as the left child and right child.

**Example: Consider the tree below. Since each node of this tree has at most 2 children, it can be said that this tree is a Binary Tree.

1

Types of Binary Tree:

2. Ternary Tree

A Ternary Tree is a tree data structure in which each node has at most **three children. These three children are usually referred to as the left child, mid child and right child.

**Example: Consider the tree below. Since each node of this tree has only 3 children, it can be said that this tree is a Ternary Tree.

frame_3070

Examples of Ternary Tree:

3. N-ary Tree (Generic Tree)

An N-ary tree is a generalization of a binary tree, such that each node can have at most N children.

**Example: Consider the tree below. Here, n=5, since each node of this tree has less than or equal to 5 children, it can be said that this tree is a n-ary tree for n = 5.

frame_3140

Examples of N-ary Trees: