SlideShare a Scribd company logo
2
Most read
5
Most read
6
Most read
Page 1 of 7
ASSIGNMENT TOPIC :
TREES IN DISCRETE STRUCTURE
DISCIPLINE :
BS (HONS)COMPUTER SCIENCES
SUBMITTED BY :
KHADIJA TAHIRA 043
SUBMITTED TO :
MA’AM NOSHEEN ILYAS
Page 2 of 7
TREE IN DISCRETE STRUCTURE
Tree is a discrete structure that represents hierarchical relationships between individual elements
or nodes. A tree in which a parent has no more than two children is called a binary tree.
Tree and its Properties
A Tree is a connected acyclic undirected graph. There is a unique path between every pair of
vertices in GG. A tree with N number of vertices contains (N−1)(N−1) number of edges. The
vertex which is of 0 degree is called root of the tree. The vertex which is of 1 degree is called leaf
node of the tree and the degree of an internal node is at least 2.
Example − The following is an example of a tree −
Centers and Bi-Centers of a Tree
The center of a tree is a vertex with minimal eccentricity. The eccentricity of a vertex XX in a
tree GG is the maximum distance between the vertex XX and any other vertex of the tree. The
maximum eccentricity is the tree diameter. If a tree has only one center, it is called Central Tree
and if a tree has only more than one centers, it is called Bi-central Tree. Every tree is either central
or bi-central.
Algorithm to find centers and bi-centers of a tree
Step 1 − Remove all the vertices of degree 1 from the given tree and also remove their incident
edges.
Step 2 − Repeat step 1 until either a single vertex or two vertices joined by an edge is left. If a
single vertex is left then it is the center of the tree and if two vertices joined by an edge is left then
it is the bi-center of the tree.
Page 3 of 7
Problem 1
Find out the center/bi-center of the following tree −
Solution
At first, we will remove all vertices of degree 1 and also remove their incident edges and get the
following tree –
Again, we will remove all vertices of degree 1 and also remove their incident edges and get the
following tree −
Finally we got a single vertex ‘c’ and we stop the algorithm. As there is single vertex, this tree
has one center ‘c’ and the tree is a central tree.
Page 4 of 7
Problem 2
Find out the center/bi-center of the following tree –
Solution
At first, we will remove all vertices of degree 1 and also remove their incident edges and get the
following tree −
Again, we will remove all vertices of degree 1 and also remove their incident edges and get the
following tree −
Finally, we got two vertices ‘c’ and ‘d’ left, hence we stop the algorithm. As two vertices joined
by an edge is left, this tree has bi-center ‘cd’ and the tree is bi-central.
Page 5 of 7
Labeled Trees
A labeled tree is a tree the vertices of which are assigned unique numbers from 1 to n. We can
count such trees for small values of n by hand so as to conjecture a general formula. The number
of labeled trees of n number of vertices is nn−2nn−2. Two labeled trees are isomorphic if their
graphs are isomorphic and the corresponding points of the two trees have the same labels.
Example
Unlabeled Trees
An unlabeled tree is a tree the vertices of which are not assigned any numbers. The number of
labeled trees of n number of vertices is (2n)!(n+1)!n!(2n)!(n+1)!n! (nth Catalan number)
Example
Page 6 of 7
Rooted Tree
A rooted tree GG is a connected acyclic graph with a special node that is called the root of the
tree and every edge directly or indirectly originates from the root. An ordered rooted tree is a
rooted tree where the children of each internal vertex are ordered. If every internal vertex of a
rooted tree has not more than m children, it is called an m-ary tree. If every internal vertex of a
rooted tree has exactly m children, it is called a full m-ary tree. If m=2m=2, the rooted tree is
called a binary tree.
Page 7 of 7
Binary Search Tree
Binary Search tree is a binary tree which satisfies the following property −
 XX in left sub-tree of vertex V,Value(X)≤Value(V)V,Value(X)≤Value(V)
 YY in right sub-tree of vertex V,Value(Y)≥Value(V)V,Value(Y)≥Value(V)
So, the value of all the vertices of the left sub-tree of an internal node VV are less than or equal
to VV and the value of all the vertices of the right sub-tree of the internal node VV are greater
than or equal to VV. The number of links from the root node to the deepest node is the height of
the Binary Search Tree.
Example

More Related Content

PDF
BinarySearchTree-bddicken
PPTX
Data analytics and visualization
PPT
Binary search trees
PDF
Data Quality for Non-Data People
PDF
UNIT I LINEAR DATA STRUCTURES – LIST
PDF
Data Science - Part III - EDA & Model Selection
PDF
Red black tree
PDF
kdtrees.pdf
BinarySearchTree-bddicken
Data analytics and visualization
Binary search trees
Data Quality for Non-Data People
UNIT I LINEAR DATA STRUCTURES – LIST
Data Science - Part III - EDA & Model Selection
Red black tree
kdtrees.pdf

What's hot (20)

PPTX
Data Cleaning Techniques
PPS
Single linked list
PPTX
Exploratory data analysis
PDF
DAMA CDMP exam cram
PPTX
PPTX
DataFrame in Python Pandas
PPT
Data Mining: Concepts and Techniques — Chapter 2 —
PPTX
Avl trees final
PPTX
Deletion from single way linked list and search
PPTX
BUBBLESORT
PDF
Data Visualization in Data Science
PDF
SQL Joins and Query Optimization
PPTX
Blockchain Basics
PPTX
Integrity Constraints
PPT
An introduction to data warehousing
PPTX
Trees data structure
PPTX
Data Wrangling
PPTX
Selection sort
PPT
Red black tree
PPTX
Decision trees
Data Cleaning Techniques
Single linked list
Exploratory data analysis
DAMA CDMP exam cram
DataFrame in Python Pandas
Data Mining: Concepts and Techniques — Chapter 2 —
Avl trees final
Deletion from single way linked list and search
BUBBLESORT
Data Visualization in Data Science
SQL Joins and Query Optimization
Blockchain Basics
Integrity Constraints
An introduction to data warehousing
Trees data structure
Data Wrangling
Selection sort
Red black tree
Decision trees
Ad

Similar to Tree in discrete structure (20)

PPTX
B.TECH Math project
PPTX
PDF
Module - 5_Trees.pdf
PPTX
TreesTreesTreesTreesTreesTreesTrees.pptx
PPT
Lecture 5 trees
PPTX
Tree all information about tree concept are available .
PPT
Binary tree
PPTX
data structure and algorithm chapter 8 computer
PPT
Lecture in the course of Discrete Mathematics
PPT
Lecture 5 tree.pptx
DOCX
Trees and Graphs in data structures and Algorithms
PPTX
Notes on trees Introduction and graphs.pptx
PPTX
Tree.pptx
PPTX
Binary Trees - Tree Terminologies and representation
PPTX
Data Structure of computer science and technology
PPTX
Farhana shaikh webinar_treesindiscretestructure
PPTX
DSA IV Unit.pptx
PPTX
Data structure using c module 2
PPTX
M ary-tree
PDF
Pattern_avoidance_in_ternary_trees
B.TECH Math project
Module - 5_Trees.pdf
TreesTreesTreesTreesTreesTreesTrees.pptx
Lecture 5 trees
Tree all information about tree concept are available .
Binary tree
data structure and algorithm chapter 8 computer
Lecture in the course of Discrete Mathematics
Lecture 5 tree.pptx
Trees and Graphs in data structures and Algorithms
Notes on trees Introduction and graphs.pptx
Tree.pptx
Binary Trees - Tree Terminologies and representation
Data Structure of computer science and technology
Farhana shaikh webinar_treesindiscretestructure
DSA IV Unit.pptx
Data structure using c module 2
M ary-tree
Pattern_avoidance_in_ternary_trees
Ad

More from Lahore Garrison University (20)

DOCX
DOCX
Application of de
PPTX
Firm practice management
PPTX
Mapping functions
PDF
Python cheatsheet for beginners
DOCX
Ternary operator
PPTX
Bussines plan (maira)
PDF
8. file handling
PPTX
Shares & stock market
DOCX
Ozone layer research paper (1)
PPTX
Introduction to information and communication technology
DOCX
Forty rulesoflove review writing
DOCX
Semester 1 exercise for punctuation mark
PDF
Scan apr 8, 2020 (1)
PDF
Application of de
Firm practice management
Mapping functions
Python cheatsheet for beginners
Ternary operator
Bussines plan (maira)
8. file handling
Shares & stock market
Ozone layer research paper (1)
Introduction to information and communication technology
Forty rulesoflove review writing
Semester 1 exercise for punctuation mark
Scan apr 8, 2020 (1)

Recently uploaded (20)

PDF
Pre independence Education in Inndia.pdf
PPTX
master seminar digital applications in india
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Institutional Correction lecture only . . .
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Classroom Observation Tools for Teachers
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Business Ethics Teaching Materials for college
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Pre independence Education in Inndia.pdf
master seminar digital applications in india
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
RMMM.pdf make it easy to upload and study
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Basic Mud Logging Guide for educational purpose
VCE English Exam - Section C Student Revision Booklet
STATICS OF THE RIGID BODIES Hibbelers.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Microbial diseases, their pathogenesis and prophylaxis
Institutional Correction lecture only . . .
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
102 student loan defaulters named and shamed – Is someone you know on the list?
human mycosis Human fungal infections are called human mycosis..pptx
Classroom Observation Tools for Teachers
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Week 4 Term 3 Study Techniques revisited.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Business Ethics Teaching Materials for college
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...

Tree in discrete structure

  • 1. Page 1 of 7 ASSIGNMENT TOPIC : TREES IN DISCRETE STRUCTURE DISCIPLINE : BS (HONS)COMPUTER SCIENCES SUBMITTED BY : KHADIJA TAHIRA 043 SUBMITTED TO : MA’AM NOSHEEN ILYAS
  • 2. Page 2 of 7 TREE IN DISCRETE STRUCTURE Tree is a discrete structure that represents hierarchical relationships between individual elements or nodes. A tree in which a parent has no more than two children is called a binary tree. Tree and its Properties A Tree is a connected acyclic undirected graph. There is a unique path between every pair of vertices in GG. A tree with N number of vertices contains (N−1)(N−1) number of edges. The vertex which is of 0 degree is called root of the tree. The vertex which is of 1 degree is called leaf node of the tree and the degree of an internal node is at least 2. Example − The following is an example of a tree − Centers and Bi-Centers of a Tree The center of a tree is a vertex with minimal eccentricity. The eccentricity of a vertex XX in a tree GG is the maximum distance between the vertex XX and any other vertex of the tree. The maximum eccentricity is the tree diameter. If a tree has only one center, it is called Central Tree and if a tree has only more than one centers, it is called Bi-central Tree. Every tree is either central or bi-central. Algorithm to find centers and bi-centers of a tree Step 1 − Remove all the vertices of degree 1 from the given tree and also remove their incident edges. Step 2 − Repeat step 1 until either a single vertex or two vertices joined by an edge is left. If a single vertex is left then it is the center of the tree and if two vertices joined by an edge is left then it is the bi-center of the tree.
  • 3. Page 3 of 7 Problem 1 Find out the center/bi-center of the following tree − Solution At first, we will remove all vertices of degree 1 and also remove their incident edges and get the following tree – Again, we will remove all vertices of degree 1 and also remove their incident edges and get the following tree − Finally we got a single vertex ‘c’ and we stop the algorithm. As there is single vertex, this tree has one center ‘c’ and the tree is a central tree.
  • 4. Page 4 of 7 Problem 2 Find out the center/bi-center of the following tree – Solution At first, we will remove all vertices of degree 1 and also remove their incident edges and get the following tree − Again, we will remove all vertices of degree 1 and also remove their incident edges and get the following tree − Finally, we got two vertices ‘c’ and ‘d’ left, hence we stop the algorithm. As two vertices joined by an edge is left, this tree has bi-center ‘cd’ and the tree is bi-central.
  • 5. Page 5 of 7 Labeled Trees A labeled tree is a tree the vertices of which are assigned unique numbers from 1 to n. We can count such trees for small values of n by hand so as to conjecture a general formula. The number of labeled trees of n number of vertices is nn−2nn−2. Two labeled trees are isomorphic if their graphs are isomorphic and the corresponding points of the two trees have the same labels. Example Unlabeled Trees An unlabeled tree is a tree the vertices of which are not assigned any numbers. The number of labeled trees of n number of vertices is (2n)!(n+1)!n!(2n)!(n+1)!n! (nth Catalan number) Example
  • 6. Page 6 of 7 Rooted Tree A rooted tree GG is a connected acyclic graph with a special node that is called the root of the tree and every edge directly or indirectly originates from the root. An ordered rooted tree is a rooted tree where the children of each internal vertex are ordered. If every internal vertex of a rooted tree has not more than m children, it is called an m-ary tree. If every internal vertex of a rooted tree has exactly m children, it is called a full m-ary tree. If m=2m=2, the rooted tree is called a binary tree.
  • 7. Page 7 of 7 Binary Search Tree Binary Search tree is a binary tree which satisfies the following property −  XX in left sub-tree of vertex V,Value(X)≤Value(V)V,Value(X)≤Value(V)  YY in right sub-tree of vertex V,Value(Y)≥Value(V)V,Value(Y)≥Value(V) So, the value of all the vertices of the left sub-tree of an internal node VV are less than or equal to VV and the value of all the vertices of the right sub-tree of the internal node VV are greater than or equal to VV. The number of links from the root node to the deepest node is the height of the Binary Search Tree. Example