AVL Tree in Data Structures- It is height balanced tree with balance factor 1, -1 or 0. The different type of rotations used in this tree are: RR, LL, RL, LR
This PPT is all about the Tree basic on fundamentals of B and B+ Tree with it's Various (Search,Insert and Delete) Operations performed on it and their Examples...
It is related to Analysis and Design Of Algorithms Subject.Basically it describe basic of topological sorting, it's algorithm and step by step process to solve the example of topological sort.
hashing is encryption process mostly used in programming language for security purpose.
This presentation will you understand all about hashing and also different techniques used in it for encryption process
This PPT is all about the Tree basic on fundamentals of B and B+ Tree with it's Various (Search,Insert and Delete) Operations performed on it and their Examples...
It is related to Analysis and Design Of Algorithms Subject.Basically it describe basic of topological sorting, it's algorithm and step by step process to solve the example of topological sort.
hashing is encryption process mostly used in programming language for security purpose.
This presentation will you understand all about hashing and also different techniques used in it for encryption process
Binary search tree.
Balancedand unbalanced BST.
Approaches to balancing trees.
Balancing binary search trees.
Perfect balance.
Avl trees 1962.
Avl good but both perfect balance.
Height of an AVL tree
Nood
AVL tree is the first dynamic tree in data structure which minimizes its height during insertion and deletion operations. This is because searching time is directly proportional to the height of binary search tree (BST). When insertion operation is performed it may result into increasing the height of the tree and when deletion is performed it may result into decreasing the height. To make the BST a height balance tree (AVL tree) creators of the AVL tree proposed various rotations. This paper shows BST and its operation and AVL.
AVL Trees
Adelson-Velskii and Landis
Binary Search Tree - Best Time
All BST operations are O(d), where d is tree depth
minimum d is for a binary tree with N nodes
What is the best case tree?
What is the worst case tree?
So, best case running time of BST operations is O(log N)
Binary Search Tree - Worst Time
Worst case running time is O(N)
What happens when you Insert elements in ascending order?
Insert: 2, 4, 6, 8, 10, 12 into an empty BST
Problem: Lack of “balance”:
compare depths of left and right subtree
Unbalanced degenerate tree
Balanced and unbalanced BST
Approaches to balancing trees
Don't balance
May end up with some nodes very deep
Strict balance
The tree must always be balanced perfectly
Pretty good balance
Only allow a little out of balance
Adjust on access
Self-adjusting
Balancing Binary Search Trees
Many algorithms exist for keeping binary search trees balanced
Adelson-Velskii and Landis (AVL) trees (height-balanced trees)
Splay trees and other self-adjusting trees
B-trees and other multiway search trees
Perfect Balance
Want a complete tree after every operation
tree is full except possibly in the lower right
This is expensive
For example, insert 2 in the tree on the left and then rebuild as a complete tree
AVL - Good but not Perfect Balance
AVL trees are height-balanced binary search trees
Balance factor of a node
height(left subtree) - height(right subtree)
An AVL tree has balance factor calculated at every node
For every node, heights of left and right subtree can differ by no more than 1
Store current heights in each node
Height of an AVL Tree
N(h) = minimum number of nodes in an AVL tree of height h.
Basis
N(0) = 1, N(1) = 2
Induction
N(h) = N(h-1) + N(h-2) + 1
Solution (recall Fibonacci analysis)
N(h) > h ( 1.62)
Height of an AVL Tree
N(h) > h ( 1.62)
Suppose we have n nodes in an AVL tree of height h.
n > N(h) (because N(h) was the minimum)
n > h hence log n > h (relatively well balanced tree!!)
h < 1.44 log2n (i.e., Find takes O(logn))
Node Heights
Node Heights after Insert 7
Insert and Rotation in AVL Trees
Insert operation may cause balance factor to become 2 or –2 for some node
only nodes on the path from insertion point to root node have possibly changed in height
So after the Insert, go back up to the root node by node, updating heights
If a new balance factor is 2 or –2, adjust tree by rotation around the node
Single Rotation in an AVL Tree
Implementation
Single Rotation
Double Rotation
Implement Double Rotation in two lines.
Insertion in AVL Trees
Insert at the leaf (as for all BST)
only nodes on the path from insertion point to root node have possibly changed in height
So after the Insert, go back up to the root node by node, updating heights
If a new balance factor is 2 or –2, adjust tree by rotation around the node
Insert in BST
Insert in AVL trees
Example of Insertions in an A
Hierarchical Digital Twin of a Naval Power SystemKerry Sado
A hierarchical digital twin of a Naval DC power system has been developed and experimentally verified. Similar to other state-of-the-art digital twins, this technology creates a digital replica of the physical system executed in real-time or faster, which can modify hardware controls. However, its advantage stems from distributing computational efforts by utilizing a hierarchical structure composed of lower-level digital twin blocks and a higher-level system digital twin. Each digital twin block is associated with a physical subsystem of the hardware and communicates with a singular system digital twin, which creates a system-level response. By extracting information from each level of the hierarchy, power system controls of the hardware were reconfigured autonomously. This hierarchical digital twin development offers several advantages over other digital twins, particularly in the field of naval power systems. The hierarchical structure allows for greater computational efficiency and scalability while the ability to autonomously reconfigure hardware controls offers increased flexibility and responsiveness. The hierarchical decomposition and models utilized were well aligned with the physical twin, as indicated by the maximum deviations between the developed digital twin hierarchy and the hardware.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
2. Binary Search Tree (BST)
Binary Search Tree, is a binary tree data structure
which has the following properties:
The left subtree of a node contains only nodes with
values lesser than the node’s value.
The right subtree of a node contains only nodes with
value greater than the node’s value.
The left and right subtree each must also be a binary
search tree.
There must be no duplicate nodes.
2
4. Skewed BST
If a tree which is dominated
by left child node or right
child node, is said to be
a Skewed Binary Tree.
In a left skewed tree, most of
the nodes have the left child
without corresponding right
child.
In a right skewed tree, most
of the nodes have the right
child without corresponding
left child.
4
5. Limitation of BST
The average search time for a binary search tree is
directly proportional to its height: O(h). Most of the
operation average case time is O(log2n).
BST’s are not guaranteed to be balanced. It may be
skewed tree also.
For skewed BST, the average search time becomes
O(n). So, it is working like an linear array.
To improve average search time and make BST
balanced, AVL trees are used.
5
6. AVL Tree
AVL tree is a height balanced tree.
It is a self-balancing binary search tree.
It was invented by Adelson-Velskii and Landis.
AVL trees have a faster retrieval.
It takes O(logn) time for insertion and deletion
operation.
In AVL tree, difference between heights of left and
right subtree cannot be more than one for all
nodes.
6
7. AVL Tree
Balance Factor of node is:
Height of left subtree – Height of Right subtree
Balance Factor is calculated for every node of AVL
tree.
At every node, height of left and right subtree can
differ by no more than 1.
For AVL tree, the possible values of balance factor
are -1, 0, 1
Balance Factor of leaf nodes is 0 (zero).
7
8. Example
Every AVL Tree is a binary search tree but all the
Binary Search Tree need not to be AVL trees.
BST and AVL
BST but not AVL
8
10. Height of AVL Tree
By the definition of complete trees, any complete
binary search tree is an AVL tree
Thus, an upper bound on the number of nodes in an
AVL tree of height h a perfect binary tree with 2h + 1 – 1
nodes.
What is a lower bound?
10
11. Height of AVL Tree
11
Let F(h) be the fewest number of nodes in a tree of
height h.
From a previous slide:
F(0) = 1
F(1) = 2
F(2) = 4
Then what is F(h) in general?
12. Height of AVL Tree
12
The worst-case AVL tree of height h would have:
A worst-case AVL tree of height h – 1 on one side,
A worst-case AVL tree of height h – 2 on the other, and
The root node
This is a recurrence relation:
11)2F()1F(
12
01
)F(
hhh
h
h
h
We get: F(h) = F(h – 1) + F(h – 2) + 1
13. Imbalance
After an insertion, when the balance factor of node A
is –2 or 2, the node A is one of the following four
imbalance types
1. LL: new node is in the left subtree of the left subtree
of A
2. LR: new node is in the right subtree of the left
subtree of A
3. RR: new node is in the right subtree of the right
subtree of A
4. RL: new node is in the left subtree of the right
subtree of A
13
14. AVL Tree Example
Insert 14, 17, 11, 7, 53, 4, 13 into an empty AVL tree
14
1711
7 53
4
14
177
4 5311
13
14
16. Types of Rotation
Single Rotation is applied when imbalanced node and
child has same sign of BF (in the direction of new
inserted node).
LL Rotation is applied in case of +ve sign. It mean left
tree is heavy and so LL rotation is done.
RR Rotation is applied in case of -ve sign. It mean right
tree is heavy and so RR rotation is done.
Double Rotation is applied when imbalanced node
and child has different signs of BF (in the direction of
new inserted node).
16
27. Deletion in AVL Tree
27
Delete 8
Balanced AVL Balanced AVL
It is also possible to delete an item from AVL Tree.
28. Deletion in AVL Tree
28
Delete 8
Balanced AVL Imbalanced AVL
Just like insertion, deletion can cause an imbalance,
which will need to be fixed by applying one of the
four rotations.
R1 Rotation
29. Deletion in AVL Tree
The deletion is also the same as in BST. However, in
imbalanced tree due to deletion, one or more rotations
need to be applied to balance the AVL tree.
The Right(R) imbalance is classified into R0, R1, R-1
The Left(L) imbalance is classified into L0, L1, L-1
29
30. Deletion in AVL Tree
LL Rotation is same to R0 and R1
RR Rotation is same to L0 and L-1
LR Rotation is same to R-1
RL Rotation is same to L1
30
32. R0 Rotation
R0 Rotation
Balanced AVL
search treeafter
rotation
B
AR
h
(0)
(+2)
A
BL BR
Unbalanced AVL
search treeafter
deletion of x
AR
h
BR
(+1)
A
BL
(-1) B
BF(B) == 0, use
R0 rotation
35. R1 Rotation
h -1
(+1) B
(+1)
A
Delete node X
h AR
x
h
BL BR
h
BL BR
(+1) B
(+2)
A
Unbalanced AVL
search tree after
deletion of node x
h -1 AR
h -1
36. R1 Rotation
R1 Rotation
Balanced AVL
search treeafter
rotation
h -1
BL BR
(+1) B
(+2)
A
R
h-1 A
BR
(0)
A
B
BL
(0)
BF(B) == 1, use
R1 rotation
h
h -1 AR