0% found this document useful (0 votes)
120 views3 pages

BSC 2 Unit III Tree

Trees and graphs are hierarchical data structures. A tree shows relationships among data and is a type of directed acyclic graph. It has a root node, with child nodes forming branches. A forest consists of multiple trees. Key terms include root, leaf/terminal nodes, internal/branch nodes, subtrees, parents and children, siblings, directed and undirected edges and paths, depth, height, and degree of nodes. Trees are used to organize hierarchical data like file systems.

Uploaded by

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

BSC 2 Unit III Tree

Trees and graphs are hierarchical data structures. A tree shows relationships among data and is a type of directed acyclic graph. It has a root node, with child nodes forming branches. A forest consists of multiple trees. Key terms include root, leaf/terminal nodes, internal/branch nodes, subtrees, parents and children, siblings, directed and undirected edges and paths, depth, height, and degree of nodes. Trees are used to organize hierarchical data like file systems.

Uploaded by

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

Trees

Trees and
Graphs:
 A Tree is a non-linear data structure used to show the hierarchical relationship
among data.
Example for a Tree:
The OS of a computer system organizes files into
folders, subfolders and files. This can be viewed as the
tree.

A tree is a graph called the directed acyclic graph.

A graph G is a set V, a set E, and a mapping from the set E to set V.


Here, V is the set of nodes, also called as vertices points, of the graph, and E is the set of
edges of the graph. We can represent them as G = (V, E).

Page | 1
Tree Terminology:
Forest and Trees 
In graph theory a forest is an acyclic graph, and a tree is a connected acyclic graph; thus
a forest may consist of a set of trees.

Directed tree: An acyclic directed graph is a directed tree.


Root: A directed tree has one node called its root, with in degree zero.
Terminal node (leaf node): In a directed tree, any node that has an out degree zero is a
terminal node. The terminal node is also called as leaf node (or external node).
Branch node (internal node): All other nodes whose out degree is not zero are called as
branch nodes.
Level of node: The level of any node is its path length from the root.
Empty tree: A set of zero items is a tree, called the empty tree (or null tree).
Sub trees: If T1, T2... Tn are n trees for n > 0 and R is a node of tree then T1, T2, ..., Tn are called
sub trees.
Degree of a node: The degree of a node is the number of sub trees it has.
Parent: Root of a tree (or sub tree) the parent.
Children: The roots of
the sub trees are the
children.
Siblings: The children
of the same node are
called siblings.

Page | 2
Edges: edges connect a root with the roots of each sub tree.
Directed edge: The relationship between a parent and its children is a directed edge.
Undirected edge: An undirected edge extends in both directions (a parent and a child).
Directed path: A directed path is a sequence of directed edges e1, e2, ..., en.
Undirected path: An undirected path is a similar sequence of undirected edges.
Length of a path: The length of a path is the number of edges it contains.
Depth or level: The depth or level of a node is the length of a directed path from the
root to that node.
Height of a tree: The height of a tree is the length of the path from the root to a node at
the lowest level.

Page | 3

You might also like