A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/dsa/types-of-trees-in-data-structures/ below:

Types of Trees in Data Structures

Types of Trees in Data Structures

Last Updated : 23 Jul, 2025

A tree in data structures 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 in a parent-child relationship.

Types of Trees Tree The main types of trees in data structure are: 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. It is widely used in applications such as binary search trees and heaps.

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

Binary Tree  Examples / Types of Binary Tree:

To know more about the types of the binary trees, please refer to this detailed article: Types of Binary Tree.

2. Ternary Tree

A Ternary Tree is a tree data structure in which each node has at most three child nodes, usually distinguished as “left”, “mid” and “right”.

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.

Examples of Ternary Tree: 3. N-ary Tree (Generic Tree)

Generic trees are a collection of nodes where each node is a data structure that consists of records and a list of references to its children(duplicate references are not allowed). Unlike the linked list, each node stores the address of multiple nodes. 

Every node stores the addresses of its children and the very first node’s address will be stored in a separate pointer called root.

 1. Many children at every node.
 2. The number of nodes for each node is not known in advance.

Example:

N-ary Tree Examples of N-ary Trees:

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4