PPT 3.1.1 Representation of Tree (1)
PPT 3.1.1 Representation of Tree (1)
2
Mission of the Department
4
Program Educational Objectives
PEO1 Demonstrate analytical and design skills including the ability to generate creative solutions and foster
team-oriented professionalism through effective communication in their careers.
PEO2 Expertise in successful careers based on their understanding of formal and practical methods of
application development using the concept of computer programming languages and design principles in
accordance to industry 4.0
PEO3 Exhibit the growth of the nation and society by implementing and acquiring knowledge of upliftment of
health, safety and other societal issues.
PEO4 Implement their exhibiting critical thinking and problem- solving skills in professional practices or tackle
social, technical and business challenges.
5
Program Specific Outcomes
6
Topic To be Covered
• Introduction(CO2)
• terminology (CO2)
• representation of tree data structure (CO3)
Tree Data Structure
Introduction
• A tree data structure is defined as a collection of objects or entities known as nodes that are
linked together to represent or simulate hierarchy.
• A tree data structure is a non-linear data structure because it does not store in a sequential
manner. It is a hierarchical structure as elements in a Tree are arranged in multiple levels.
• The topmost node in tree is known as a root node.
Basic Terminologies In Tree Data Structure:
Terminology Description Example from Diagram
Node Each vertex of a tree is a node. ‘1’, ‘2’, ‘3’ are the node in the tree.
Root Topmost node of a tree. Node ‘1’ is the topmost root node.
Node ‘2’ is the parent of ‘5’ and ‘6’, and Node ‘3’ is the
Parent Node The node has an edge-sharing to a child node. parent of ‘7’.
Child Node The sub-node of a parent node is the child node. ‘5’ and ‘6’ is the children of ‘2’.
The last node which does have any subnode is the leaf
Leaf or External node node. ‘5’, ‘6’, ‘9’ and ‘8’ are leaf nodes.
The link between ‘1’ and ‘2’, ‘2’ and ‘5’, ‘2’ and ‘6’ are
Edge Connecting link between two nodes.
edges
Siblings Nodes with the same parent are siblings. ‘5’ and ‘6’ are siblings with ‘2’ as their parent.
Sub-Tree Descendants of a node represent a subtree. Nodes ‘2’, ‘5’, and ‘6’ represent a sub-tree.
• The first node from where the tree originates is called as a root node.
• In any tree, there must be only one root node.
• We can never have multiple root nodes in a tree data structure.
Edge
• The node which has a branch from it to any other node is called as a parent node.
• In other words, the node which has one or more children is called as a parent node.
• In a tree, a parent node can have any number of child nodes.
Child
• The node which does not have any child is called as a leaf node.
• Leaf nodes are also called as external nodes or terminal nodes
Internal Nodes / Non Terminal Nodes
• The node which has at least one child is called as an internal node.
• Internal nodes are also called as non-terminal nodes.
• Every non-leaf node is an internal node.
Degree
• In a tree data structure, the sequence of Nodes and Edges from one node to another node is called
as PATH between that two Nodes. Length of a Path is total number of nodes in that path. In below
example the path A - B - E - J has length 4.
Subtree
struct Node
{
int data;
struct Node *first_child;
struct Node *second_child;
struct Node *third_child;
.
.
.
struct Node *nth_child;
};
Book References
TEXT BOOKS
• Seymour Lipchitz, Schaum's Outlines Series Data Structures TMH. J.P. Hayes,
Computer Organization and Architecture, Third Edition, TMH.
• Data Structure Theory Problem and Algorithms, R.S. Salaria, Khanna Book
Publishing Company, Delhi.
REFERENCE BOOKS
• Introduction to Data Structures Applications, Trembley&Soreson, Second
Edition, Pearson Education Robert L. Britton, MIPS Assembly Language
Programming, Pearson Prentice Hall.
• A. Tanenbaum, Y. Lanhgsam and A. J. Augenstein, Data Structures Using C++,
Prentice Hall of India, 1990
Video Links
https://www.youtube.com/watch?v=YAdLFsTG70w
THANK YOU