Trees are useful for representing hierarchically ordered data like directory structures and family trees. A tree is a collection of nodes connected by branches, with each node having at most one parent. It is defined recursively as a root node with zero or more subtrees. Binary trees restrict nodes to having at most two children. Trees can be traversed in preorder, inorder, or postorder. Binary search trees organize nodes to keep all left descendants less than the parent and all right descendants greater than the parent. Graphs generalize trees by allowing many-to-many relationships between nodes.
Students can learn Trees concept in data structures. various types of data structures like binary trees, expression trees, binary search trees and AVL trees are covered in this PPT.
Students can learn Trees concept in data structures. various types of data structures like binary trees, expression trees, binary search trees and AVL trees are covered in this PPT.
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 is a demo presentation prepared for the recruitment of Lecturer in CSE at Green University. In this presentation, an introduction to Data Structures is demonstrated in an intuitive way.
In computer programming, a data structure may be selected or designed to store data for the purpose of working on it with various algorithms. Each data structure contains information about the data values, relationships between the data and functions that can be applied to the data.
Student will be able to learn linear data structures concepts in detailed manner. This PPT comprises of the following topics: LIST ADT, Singly Linked List, Doubly Linked List, Circular Linked List, Applications of Linked List, Applications of Stack and Queue, Tower of Hanoi, Balancing Parenthesis
Students will be able to learn the concepts of advanced trees like Splay Tree, B Tree, Red Black Tree, Priority Queue or Heap. In Heap Data Structure the following methods are covered: Binary Heap, d-heap, Leftist Heap and Skew Heap.
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 is a demo presentation prepared for the recruitment of Lecturer in CSE at Green University. In this presentation, an introduction to Data Structures is demonstrated in an intuitive way.
In computer programming, a data structure may be selected or designed to store data for the purpose of working on it with various algorithms. Each data structure contains information about the data values, relationships between the data and functions that can be applied to the data.
Student will be able to learn linear data structures concepts in detailed manner. This PPT comprises of the following topics: LIST ADT, Singly Linked List, Doubly Linked List, Circular Linked List, Applications of Linked List, Applications of Stack and Queue, Tower of Hanoi, Balancing Parenthesis
Students will be able to learn the concepts of advanced trees like Splay Tree, B Tree, Red Black Tree, Priority Queue or Heap. In Heap Data Structure the following methods are covered: Binary Heap, d-heap, Leftist Heap and Skew Heap.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
CFD analysis is incredibly effective at solving mysteries and improving the performance of complex systems!
Here's a great example: At a large natural gas-fired power plant, where they use waste heat to generate steam and energy, they were puzzled that their boiler wasn't producing as much steam as expected.
R&R and Tetra Engineering Group Inc. were asked to solve the issue with reduced steam production.
An inspection had shown that a significant amount of hot flue gas was bypassing the boiler tubes, where the heat was supposed to be transferred.
R&R Consult conducted a CFD analysis, which revealed that 6.3% of the flue gas was bypassing the boiler tubes without transferring heat. The analysis also showed that the flue gas was instead being directed along the sides of the boiler and between the modules that were supposed to capture the heat. This was the cause of the reduced performance.
Based on our results, Tetra Engineering installed covering plates to reduce the bypass flow. This improved the boiler's performance and increased electricity production.
It is always satisfying when we can help solve complex challenges like this. Do your systems also need a check-up or optimization? Give us a call!
Work done in cooperation with James Malloy and David Moelling from Tetra Engineering.
More examples of our work https://www.r-r-consult.dk/en/cases-en/
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
2. Linear Lists and Trees
• Linear lists (arrays, linked list)are useful for serially ordered
data
– (e1,e2,e3,…,en)
– Days of week
– Months in a year
– Students in a class
• Trees are useful for hierarchically ordered data
– directory structure
– Parenthetical Listing
– family trees:
• all descendants of a particular person
• all ancestors born after year 1800 of a particular person
4. Tree
A tree is a collection of Nodes
and a finite set of directed lines called branches, that connect the nodes.
Each node can have 0 or more children
A node can have at most one parent
Tree defined recursively
A tree consists of a distinguished node r, called the root, and zero or more
non-empty (sub) trees T1, T2, …, Tk each of whose roots are connected by
a directed edge from r.
A tree is a collection of N nodes, one of which is the root and N-1 edges.
The number of branches associated with a node is the degree of the
node.
Binary tree
Tree with 0–2 children per node
5. Terminology
Root no parent
Leaf no child
Interior non-leaf
Height distance from root to leaf
The root of each sub tree is said to be a child of r and r is
said to be the parent of each sub tree root.
Siblings nodes with the same parent
6. • Depth (of node): the length of the unique path from the root to a
node.
• Depth (of tree): The depth of a tree is equal to the depth of its
deepest leaf.
• Height (of node): the length of the longest path from a node to a
leaf.
– All leaves have a height of 0
– The height of the root is equal to the depth of the tree
• When the branch is directed toward the node, it is indegree branch.
• When the branch is directed away from the node, it is an outdegree
branch.
• The sum of the indegree and outdegree branches is the degree of the
node.
7.
8.
9. Recursive definition of a tree
• A tree is a set of nodes that either:
- is empty or
- has a designated node, called the root, from
which hierarchically descend zero or more sub
trees, which are also trees.
9
10. Binary trees
• A binary tree is a tree in which no node can
have more than two subtrees; the maximum
outdegree for a node is two.
• In other words, a node can have zero, one, or
two subtrees.
• These subtrees are designated as the left
subtree and the right subtree.
11.
12.
13.
14. Picture of a binary tree
a
b c
d e
g h i
l
f
j k
16. Preorder traversal
• In preorder, the root is visited first
• Here’s a preorder traversal to print out all
the elements in the binary tree:
A
B C
D E F G
A B D E C F G
34. Binary Search Trees
• Binary Search Tree Property:
– the value stored at the root of a sub tree is greater than any value in its
left sub tree and less than any value in its right sub tree!
• Where is the smallest element?
– leftmost element
• Where is the largest element?
– rightmost element
• How to build & maintain binary trees?
– Insertion
– Deletion
• Maintain key property (invariant)
– Smaller values in left sub tree
– Larger values in right sub tree
35. Binary Search Trees
• Key property
– Value at node
• Smaller values in left subtree
• Larger values in right subtree
– Example
• X > Y
• X < Z
Y
X
Z
36. Binary Search Trees
• Examples
Binary search
trees
Not a binary
search tree
5
10
30
2 25 45
5
10
45
2 25 30
5
10
30
2
25
45
37. Binary Search Tree – Insertion
• Algorithm
1. Perform search for value X
2. Search will end at node Y (if X not in tree)
3. If X < Y, insert new leaf X as new left sub tree for Y
4. If X > Y, insert new leaf X as new right sub tree for Y
• Observations
– O( log(n) ) operation for balanced tree
39. Binary Search Tree – Deletion
Algorithm
1. Perform search for value X
2. If X is a leaf, delete X
3. Else // must delete internal node
a) Replace with largest value Y on left sub tree
OR smallest value Z on right sub tree
b) Delete replacement value (Y or Z) from sub tree
Observation
- O( log(n) ) operation for balanced tree
41. Example Deletion (Internal Node)
• Delete ( 10 )
5
10
30
2 25 45
5
5
30
2 25 45
2
5
30
2 25 45
Replacing 10
with largest
value in left sub
tree
Replacing 5 with
largest value in
left sub tree
Deleting leaf
42. Example Deletion (Internal Node)
• Delete ( 10 )
5
10
30
2 25 45
5
25
30
2 25 45
5
25
30
2 45
Replacing 10
with smallest
value in right
sub tree
Deleting leaf Resulting tree
43. Iterative Search of Binary Tree
Node *Find( Node *n, int key) {
while (n != NULL) {
if (n->data == key) // Found it
return n;
if (n->data > key) // In left subtree
n = n->left;
else // In right subtree
n = n->right;
}
return null;
}
Node * n = Find( root, 5);
44. Recursive Search of Binary Tree
Node *Find( Node *n, int key) {
if (n == NULL) // Not found
return( n );
else if (n->data == key) // Found it
return( n );
else if (n->data > key) // In left subtree
return Find( n->left, key );
else // In right subtree
return Find( n->right, key );
}
Node * n = Find( root, 5);
45. Example Binary Searches
• Find ( root, 2 )
5
10
30
2 25 45
5
10
30
2
25
45
10 > 2, left
5 > 2, left
2 = 2, found
5 > 2, left
2 = 2, found
root
46. Example Binary Searches
• Find (root, 25 )
5
10
30
2 25 45
5
10
30
2
25
45
10 < 25, right
30 > 25, left
25 = 25, found
5 < 25, right
45 > 25, left
30 > 25, left
10 < 25, right
25 = 25, found
47. Types of Binary Trees
• Degenerate – only one child
• Balanced – “mostly” two children
• Complete – always two children
Degenerate
binary tree
Balanced
binary tree
Complete
binary tree
48. Introduction to Graph
• What is a graph?
– A data structure that consists of a set of nodes
(vertices) and a set of edges that relate the nodes to
each other
• The set of edges describes relationships among
the vertices
• A graph G is defined as follows:
G=(V,E)
V(G): a finite, nonempty set of vertices
E(G): a set of edges (pairs of vertices)
49. Directed vs. undirected graphs
• When the edges in a graph have no direction,
the graph is called undirected
50. Directed vs. undirected graphs (cont.)
• When the edges in a graph have a direction,
the graph is called directed (or digraph)
Warning: if the graph is directed, the order of the vertices in each edge is
important !!
52. Graph terminology
• Adjacent nodes: two nodes are adjacent if they are connected
by an edge
– 5 is adjacent to 7
– 7 is adjacent from 5
• Path: a sequence of vertices that connect two nodes in a
graph
• Complete graph: a graph in which every
vertex is directly connected to
every other vertex
53. Graph terminology
• What is the number of edges in a complete
directed graph with N vertices?
N * (N-1)
54. Graph terminology
• What is the number of edges in a complete
undirected graph with N vertices?
N * (N-1) / 2
56. Graph implementation
• Array-based implementation
– A 1D array is used to represent the vertices
– A 2D array (adjacency matrix) is used to represent
the edges