0% found this document useful (0 votes)
2K views18 pages

Final PPT Trees

Tree is a hierarchical data structure where data is organized in a parent-child relationship. It has a root node with child nodes connected by edges. Key terms include root, edge, parent, child, siblings, degree, internal node, leaf node, level, height, depth, subtree, path, ancestors, and forest.

Uploaded by

marv hartigan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views18 pages

Final PPT Trees

Tree is a hierarchical data structure where data is organized in a parent-child relationship. It has a root node with child nodes connected by edges. Key terms include root, edge, parent, child, siblings, degree, internal node, leaf node, level, height, depth, subtree, path, ancestors, and forest.

Uploaded by

marv hartigan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Tree Data

Structure
Name-Glen Joe
class-SY BCS
Roll no-21
What is aTree?
Tree data structure may be defined as
Tree is a non-linear data structure which organizes data in a hierarchical structure
Tree Terminology
Important terms related to tree are
1. Root-
• 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.
2. Edge-
• The connecting link between any two nodes is called as an
edge.
• In a tree with n number of nodes, there are exactly (n-1)
number of edges
3. Parent-
• 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.
4. Child-
• The node which is a descendant of some node is called as a
child node.
• All the nodes except root node are child nodes.
5. Siblings-
• Nodes which belong to the same parent are called as siblings.
• In other words, nodes with the same parent are sibling nodes..
6. Degree-
• Degree of a node is the total number of children of that node.
• Degree of a tree is the highest degree of a node among all the
nodes in the tree
7.Internal Node-
• 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.
8. Leaf Node-
• 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..
9. Level-
• In tree data structures, the root node is said to be at level 0,
and the root node's children are at level 1, and the children of
that node at level 1 will be level 2, and so on..
10. Height-
• In a tree data structure, the number of edges from the leaf
node to the particular node in the longest path is known as the
height of that node.
• In the tree, the height of the root node is called "Height of
Tree".
• The tree height of all leaf nodes is 0.
11. Depth-
• In a tree, many edges from the root node to the particular
node are called the depth of the tree.
• In the tree, the total number of edges from the root node to
the leaf node in the longest path is known as "Depth of Tree".
• In the tree data structures, the depth of the root node is 0.
12. Subtree-
• In a tree, each child from a node forms a subtree recursively.
• Every child node forms a subtree on its parent node.
13. Path-
• In the tree in data structures, the sequence of nodes and edges
from one node to another node is called the path between
those two nodes.
• The length of a path is the total number of nodes in a path.
13. Ancestors-
• Ancestors of a node are all the nodes along the path from the
root to that node
• The ancestor of node 9 are 7, 3 and 1
• The ancestor of node 6 is 3 and 1
13. Forest-
• A forest is a set of disjoint trees.

You might also like