Common Use of Tree as a Data Structure
ADVANCE
1. Nodes
2. Parent Nodes & Child Nodes
3. Leaf Nodes
4. Root Node
5. Sub Tree
6. Level of a tree:
7. m-ary Tree
8. Binary Tree (BT)
9. Complete and Full Binary Tree
10. Traversal
11. Binary Search Tree (BST)
12. Inorder Traversal – Left_ParentNode_Right
13. Postorder Traversal – Left_Right_ParentNode
14. Preorder Traversal – ParentNode_Left_Right
15. Binary Search Tree (BST)
16. BST - Insert, Delete
BEGINNER
1. Nodes
2. Parent Nodes & Child Nodes
3. Leaf Nodes
4. Root Node
5. Sub Tree
6. Level of a tree
7. m-ary Tree
8. Binary Tree (BT)
9. Binary Search Tree (BST)
10. BST - Insert, Delete
Common Use of Tree as a Data Structure
INTERMEDIATE
1. Nodes
2. Parent Nodes & Child Nodes
3. Leaf Nodes
4. Root Node
5. Sub Tree
6. Level of a tree:
7. m-ary Tree
8. Binary Tree (BT)
9. Complete and Full Binary Tree
10. Traversal
11. Binary Search Tree (BST)
12. BST - Insert, Delete
BEGINNER
1. Nodes
2. Parent Nodes & Child Nodes
3. Leaf Nodes
4. Root Node
5. Sub Tree
6. Level of a tree
7. m-ary Tree
8. Binary Tree (BT)
9. Binary Search Tree (BST)
10. BST - Insert, Delete
Common Use of Tree as a Data Structure
INTERMEDIATE
1. Nodes
2. Parent Nodes & Child Nodes
3. Leaf Nodes
4. Root Node
5. Sub Tree
6. Level of a tree:
7. m-ary Tree
8. Binary Tree (BT)
9. Complete and Full Binary Tree
10. Traversal
11. Binary Search Tree (BST)
12. BST - Insert, Delete
Tree and Binary search tree in data structure.
The complete explanation of working of trees and Binary Search Tree is given. It is discussed such a way that everyone can easily understand it. Trees have great role in the data structures.
Slides cover definition of tree data structure with examples, related terminologies, accessors methods, query methods, generic methods, traversal algorithms (preorder, postorder, inorder) traversal, Binary tree, Binary tree implementation using linked list and array, Binary search
a. Concept and Definition
b. Binary Tree
c. Introduction and application
d. Operation
e. Types of Binary Tree
• Complete
• Strictly
• Almost Complete
f. Huffman algorithm
g. Binary Search Tree
• Insertion
• Deletion
• Searching
h. Tree Traversal
• Pre-order traversal
• In-order traversal
• Post-order traversal
Slides at myblog
http://www.ashimlamichhane.com.np/2016/07/tree-slide-for-data-structure-and-algorithm/
Assignments at github
https://github.com/ashim888/dataStructureAndAlgorithm/tree/dev/Assignments/assignment_7
This presentation is useful to study about data structure and topic is Binary Tree Traversal. This is also useful to make a presentation about Binary Tree Traversal.
This Presentation will Clear the idea of non linear Data Structure and implementation of Tree by using array and pointer and also Explain the concept of Binary Search Tree (BST) with example
Tree and Binary search tree in data structure.
The complete explanation of working of trees and Binary Search Tree is given. It is discussed such a way that everyone can easily understand it. Trees have great role in the data structures.
Slides cover definition of tree data structure with examples, related terminologies, accessors methods, query methods, generic methods, traversal algorithms (preorder, postorder, inorder) traversal, Binary tree, Binary tree implementation using linked list and array, Binary search
a. Concept and Definition
b. Binary Tree
c. Introduction and application
d. Operation
e. Types of Binary Tree
• Complete
• Strictly
• Almost Complete
f. Huffman algorithm
g. Binary Search Tree
• Insertion
• Deletion
• Searching
h. Tree Traversal
• Pre-order traversal
• In-order traversal
• Post-order traversal
Slides at myblog
http://www.ashimlamichhane.com.np/2016/07/tree-slide-for-data-structure-and-algorithm/
Assignments at github
https://github.com/ashim888/dataStructureAndAlgorithm/tree/dev/Assignments/assignment_7
This presentation is useful to study about data structure and topic is Binary Tree Traversal. This is also useful to make a presentation about Binary Tree Traversal.
This Presentation will Clear the idea of non linear Data Structure and implementation of Tree by using array and pointer and also Explain the concept of Binary Search Tree (BST) with example
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as “distorted thinking”.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
How to Create Map Views in the Odoo 17 ERPCeline George
The map views are useful for providing a geographical representation of data. They allow users to visualize and analyze the data in a more intuitive manner.
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
2. DATA STRUCTURE - TREE
Many applications are
hierarchical in nature.
Linear data structures are not
appropriate for these type of
applications.
Tree 2
President
Vice President
Executive Executive
Vice President
Executive
Vice President
Executive Executive
Mashrafi Khan
Mairufa Khan
Junayed
Ahmed
Masrufa
Ahmed
Fahim Khan
Ashfar
Khan
Moin Khan
Imran
Khan
Bushra
Khan
Faizul Khan
Mahboob
Khan
Mashrufa
Khan
Mashraba
Khan
Hierarchical structure of a company
Genealogy tree of a family
3. COMMON USE OF TREE AS A DATA STRUCTURE
Representing hierarchical data
Storing data in a way that makes it easily searchable
Representing sorted lists of data
As a workflow for compositing digital images for visual effects
Routing algorithms
Tree 3
4. TREE - DEFINITION
As a data structure, a tree consists of one
or more nodes, where each node has a
value and a list of references to other (its
children) nodes.
A tree must have a node designated as
root. If a tree has only one node, that
node is the root node. Root is never
referenced by any other node.
Having more than one node indicates that
the root have some (at least one)
references to its children nodes and the
children nodes (might) have references to
their children nodes and so on.
Tree 4
A
B C D
E F JIHG
K ML ON
ROOT
VALUE
CHILDCHILD
5. TREE - DEFINITION
Generally it is considered that in a tree,
there is only one path going from one
node to another node.
There cannot be any cycle or loop.
The link from a node to other node is
called an edge.
An arrowed edge
indicates flow from P to Q.
An straight line edge
indicates flow from P to Q and Q to P.
Tree 5
A
B C D
E F JIHG
K ML ON
If node F is reached through node B, than the link from
node K to node F will not be considered.
If link from node L to node C is considered, than there
will be a cycle among nodes C, G, and L.
P Q
P Q
A straight line is generally used to represent the links
between the nodes of a tree.
6. TREE - DEFINITION
Nodes
Parent Nodes & Child Nodes
Leaf Nodes: nodes with no child
Root Node: node with no parent
Sub Tree: the tree rooted by a child
Level of a tree:
Root at level 0;
Each children have the level one more than
its parent.
Height/depth of the tree: Total
number of Levels
Height of a node: Total number of
levels from bottom
[Tree height – node level].
Tree 6
A
B C D
E F JIHG
K ML ON
LEVEL
0
1
2
3
Height of this tree is 4, as there are four levels (0…3).
Height of root A is 4;
Height of nodes B, C, D is 3;
Height of E, F, G, H, I, J is 2;
Height of nodes K, L , M, N, O is 1.
7. m-ARY TREE
A Tree is an m-ary Tree when each of its node has no more than m children.
Tree 7
A
B C D
E F JIHG
K ML ON
A
B D
E F IH
GK
ML
ON
2-ary tree 3-ary tree
8. BINARY TREE (BT)
Each node of a binary Tree has at most 2 children.
Tree 8
A
B D
E F IH
GK
ML
ON
Binary tree
9. COMPLETE AND FULL BINARY TREE
A complete/full binary tree is a binary tree,
which is completely filled with nodes from
top to bottom and left to right.
The tree starts from the root (top), goes to
the next level with first the left child and
then the right child (left to right). The
process repeats for each next level with
each node till the last (bottom) level.
In complete binary tree some of the nodes
only for the bottom level might be absent
(here nodes after N).
In Full binary tree the last/bottom level
must also be filled up.
Tree 9
A
B D
E F IH
GK ML N C J P
10. COMPLETE AND FULL BINARY TREE
A full binary tree of depth n is a binary tree of depth n with 2n - 1 nodes, n >=0.
A binary tree with k nodes and depth n is a complete binary tree if and only if its
nodes correspond to the nodes numbered from 0 to k-1 in the full binary tree of
depth n.
Tree 10
A
B D
E F IH
GK ML N C J P
Level=0,
# of nodes=20=1
Level=1,
# of nodes=21=2
Level=2,
# of nodes=22=4
Level=3,
# of nodes=23=8
Total Number of Nodes:
20+ 21+ 22+ 23 = 24 - 1 = 15
Height of the tree: Log215 = 4
If total number of nodes are n,
Nodes at each level L = 2L
Bottom Level = BL
Height h = BL+1 = Log2n
Total nodes = 2h – 1 = n
11. TRAVERSAL
Systematic way of visiting all the nodes.
Methods:
Inorder
Postorder
Preorder
They all traverse the left subtree before the right subtree.
Tree 11
12. INORDER TRAVERSAL – LEFT_PARENTNODE_RIGHT
Traverse the left subtree
Visit the parent node
Traverse the right subtree
Tree 12
A
B D
E F H
K ML C
K E L B F M A H C D
13. POSTORDER TRAVERSAL – LEFT_RIGHT_PARENTNODE
Traverse the left subtree
Traverse the right subtree
Visit the parent node
Tree 13
A
B D
E F H
K ML C
K L E M F B C H D A
14. PREORDER TRAVERSAL – PARENTNODE_LEFT_RIGHT
Visit the parent node
Traverse the left subtree
Traverse the right subtree
Tree 14
A
B D
E F H
K ML C
A B E K L F M D H C
15. BINARY SEARCH TREE (BST)
Is a Binary Tree such that:
Every node entry has a unique key (i.e. no duplication item).
All the keys in the left subtree of a node are less than the key of the node.
All the keys in the right subtree of a node are greater than the key of the node.
Tree 15
43
31 64
20 40 8956
3328 47 59
Fred
Dan Mary
Alan Eve SueKate
EricBill Greg Len
Integer Key String Key
16. BST - INSERT
Tree 16
43
31 64
20 40 8956
3328 47 59
> <
< <
<><
>
>
>
Fred
Dan Mary
Alan Eve SueKate
EricBill Greg Len
> <
< >
> <<
>
>
<
Integer Key String Key
43 31 64 40 20 89 56 47 33 28 59Fred Mary Kate Dan Len Alan Eve Bill Sue Greg Eric
18. BST - DELETE
Delete 47 (leaf node);
Delete 40 (have only one child);
Delete 64 and 31 (have both child).
Tree 18
43
31 64
20 40 8956
3828 47 59
32
33
5932
Leaf Node: Just DeleteLeaf Node: Just Delete
Node with one child:
connect the parent to
the child and Delete
Node with one child: connect the
parent to the child and Delete
Node with two
children on right
subtree: Replace with
the child with highest
value either from left
or right subtree
Node with two
children on left
subtree: Replace with
the child with lowest
value either from left
or right subtree