Download - Tree (Data Structure & Discrete Mathematics)
![Page 1: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/1.jpg)
Title Layout
• Subtitle
![Page 2: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/2.jpg)
Course: CSE131 (Discrete Mathematics)Course Teacher: Ms. Shadaab Kawnain Bashir (SKB)Section: P Group: A Depertment: CSE(43 Batch)Group Members: 01. Md. Ashaf Uddaula (161-15-7473)02. Alamin Hossain (161-15-7483)03. Md. Khasrur Rahman (161-15-7214)04. Ijaz Ahmed Utsa (161-15-7180)
![Page 3: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/3.jpg)
Going to Tell About…….Definition of TreeBasic Terminology of TreeClassification of TreeM-ary TreeFull M-ary TreeBinary TreeStrictly Binary Tree (SBT)Complete Binary Tree (CBT)Almost Binary Tree (ALT)Ordered Rooted Tree
Decision Tree Traversing Binary Tree
![Page 4: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/4.jpg)
What is Tree?• An undirected graph is a tree if
and only if there is a unique simple path between any two of its vertices.
• Every Tree is a Graph ,but every Graph is not a tree.
![Page 5: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/5.jpg)
Basic Terminology of Tree Node
Edge
Root
Leaf Node
Depth
Height
Parent
Children
Siblings
Ancestors
Descendants
Sub-Tree
![Page 6: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/6.jpg)
Basic Terminology of TreeNode: A node is a fundamental part of a tree. Each letter represents one node.
Edge: The arrows from one node to another are called edges.
![Page 7: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/7.jpg)
Basic Terminology of TreeRoot: The root of the tree is the only node in the tree that has no incoming edges.
Here, a is the root.
Leaf Node: A leaf node is a node that has no children.The bottom nodes (with no outgoing edges) are the leaves .
Here, c , i , j , k , l , m are leaves Node.
![Page 8: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/8.jpg)
Basic Terminology of TreeDepth: Depth tells the number of steps (nodes) to get from a node back to the root.
Height: The height of a tree is equal to the maximum level of any node in the tree.
This tree has height 5, so the maximum depth is 4 (height - 1).
![Page 9: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/9.jpg)
Basic Terminology of TreeParent: a is the parent of b , c , d
b is the parent of e
d is the parent of f , g , h
e is the parent of i , j
f is the parent of k
h is the parent of l , m
Siblings: b , c , d are siblings of each other
f , g , h are siblings of each other
i , j are siblings of each other
l , m are siblings of each other
Children: b , c , d are children of a
f , g , h are children of d
e is the children of b
i , j are the children of e
k is the children of f
l , m are the children of h
![Page 10: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/10.jpg)
Basic Terminology of Tree
![Page 11: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/11.jpg)
Basic Terminology of Tree
• Sub-Tree: A sub-tree of a given node includes one of its children and all of that child's descendants.
![Page 12: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/12.jpg)
Classification of Tree
![Page 13: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/13.jpg)
m-ary tree : A rooted tree is called an m-ary tree if every internal vertex has no more than m children.
full m-ary tree :A tree is called a full m-ary tree if every internal vertex has exactly m children.
binary tree :An m-ary tree with m 2 is called a binary tree
![Page 14: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/14.jpg)
Strictly Binary Tree (SBT)• The tree is said to be strictly binary tree , if every non-leaf node made
in a binary tree has non empty left & right sub-tree.
• A strictly binary tree with n leaves node always contains 2n-1 nodes.
![Page 15: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/15.jpg)
Complete Binary Tree (CBT)
• . A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.
![Page 16: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/16.jpg)
Almost Binary Tree (ALT)
• An almost complete binary tree is a tree where for a right child, there is always a left child, but for a left child there may not be a right child.
![Page 17: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/17.jpg)
Decision Tree
• A decision tree is a decision support tool that uses atree-like graph or model of decisions and their possible consequences, including chance event outcomes, resource costs, and utility. It is one way to display an algorithm.
![Page 18: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/18.jpg)
Traversing Binary Tree
Traversal in Binary Tree
Pre-order Traversal
In-order Traversal
Post-order Traversal
![Page 19: Tree (Data Structure & Discrete Mathematics)](https://reader035.vdocuments.net/reader035/viewer/2022062503/58ed344a1a28abb2538b46c1/html5/thumbnails/19.jpg)