Question: 1. Explain the terms ‒ root, leaves, degree of tree and internal and external nodes.
Introduction
to Trees
Definition of Tree :
Tree is a non‒linear data structure in which ‒
i)
There is a specially designated node called root.
ii)
The remaining nodes are partitioned into n>=0 disjoint sets T1, T2,
T3,... Tn
where
T1, T2, T3, ...,Tn are called the sub‒trees of the root.
The
concept of tree is represented by following Fig. 6.1.1.

Let
us get introduced with some of the definitions or terms which are normally
used.

From
Fig. 6.1.2,
Root is a unique node in the tree to which further subtrees are attached. For above given tree, node 10 is a root node.
The
node having further sub‒branches is called parent node. In Fig. 6.1.3 the 20 is
parent node of 40, 50 and 60.

The
child nodes in above given tree are marked as shown below.

These
are the terminal nodes of the tree.
For example

The
total number of sub‒trees attached to that node is called the degree of a node.
For example

The
maximum degree in the tree is degree of tree.

The
root node is always considered at level zero.
The
adjacent nodes to root are supposed to be at level 1 and so on.

The
maximum level is the height of the tree. In Fig. 6.1.8 the height of tree is 3.
Sometimes height of the tree is also called depth of tree.
While
displaying the tree, if some particular node occurs previous to some other node
then that node is called predecessor
of the other node.
For example :
While displaying the tree in Fig. 6.1.8 if we read node 20 first and then if we
read node 40, then 20 is a predecessor of 40.
Successor
is a node which occurs next to some node.
For example :
While displaying tree in Fig. 6.1.8 if we read node 60 after reading node 20
then 60 is called successor of 20.
Leaf
node means a node having no child node. As leaf nodes are not having further
links, we call leaf nodes external nodes
and non leaf nodes are called internal
nodes.

The
nodes with common parent are called siblings or brothers.
For example

Review Question
1. Explain the terms ‒
root, leaves, degree of tree and internal and external nodes.
Data Structures using C PlusPlus: Chapter 6: Trees : Tag: Data Structure, C++ Programing : Data Structures using C++ Program - Introduction to Trees
Data Structures using CPlusPlus
CS25C05 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
English Essentials II
EN25C02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Tamils and Technology தமிழர்களும் தொழில்நுட்பமும்
UC25H02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Linear Algebra
MA25C02 2nd Semester | 2025 Regulation
Electron Devices
EC25C01 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Data Structures using CPlusPlus
CS25C05 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Circuits and Network Analysis
EC25C02 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Re-Engineering for Innovation
ME25C05 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Engineering Drawing - Laboratory
ME25C01 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Data Structures using CPlusPlus - Laboratory
CS25C05 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Devices and Circuits Laboratory
EC25C03 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation