tutorialcup@gmail.com

Tree Data Structure

What is a tree ?

A general tree is a tree where each node may have zero or more children. Tree is a non-linear data structure which organizes data in hierarchical structure.
Every element is called a Node. Node stores data of that element and link to other element in hierarchical structure.

Tree Terminology

Root

In a tree data structure, the first node is called as Root Node. It is the origin of the data structure. Every tree must have root node.

Edge

The connecting link between any two nodes is called as Edge.

Parent

The node which is predecessor of any node is called as Parent node.

Child

The node which is descendent of any node is called as Child node.

Leaf

The node which does not have a child is called as Leaf node.   

Internal nodes

The node which has at least one node is called as Internal node.

Sub tree

Sub tree represents the descendants of a node. Each child from a node forms a subtree recursively.

Examples

File systems, family tree etc

Figure : Tree for File System


C++ Online Test - Check Your Rank across the World


Next >
Scroll to Top