SlideShare a Scribd company logo
Unit- 3
AVL trees
 AVL trees are binary search trees in which the difference
between the height of the left and right subtree is either -1, 0,
or +1.
 AVL trees are also called a self-balancing binary search tree.
These trees help to maintain the logarithmic search time. It is
named after its inventors (AVL) Adelson, Velsky, and Landis.
 Balance Factor = (Height of Left Subtree - Height of Right
Subtree)
 https://www.javatpoint.com/insertion-in-avl-tree
Rotations
 Left – Left Rotation
 Right – Right Rotation
 Right – Left Rotation
 Left – Right Rotation
 https://www.tutorialspoint.com/data_str
uctures_algorithms/avl_tree_algorithm
.htm
Insertion
Deletion(from right sub tree)
Advantages of AVL Trees
 The height of the AVL tree is always
balanced. The height never grows
beyond log N, where N is the total
number of nodes in the tree.
 It gives better search time complexity
when compared to simple Binary
Search trees.
 AVL trees have self-balancing
capabilities.
B Tree
 B Trees is similar to that in Binary
search tree
 B-Tree is a self-balanced search tree
in which every node contains multiple
keys and has more than two children.
Operations
 Insertion
 Deletion
 Search
Properties
 All leaves are at the same level.
 A B-Tree is defined by the term minimum degree ‘t’. The
value of t depends upon disk block size.
 Every node except root must contain at least (ceiling)([t-1]/2)
keys. The root may contain minimum 1 key.
 All nodes (including root) may contain at most t – 1 keys.
 Number of children of a node is equal to the number of keys
in it plus 1.
 All keys of a node are sorted in increasing order. The child
between two keys k1 and k2 contains all keys in the range
from k1 and k2.
 B-Tree grows and shrinks from the root which is unlike Binary
Search Tree. Binary Search Trees grow downward and also
shrink from downward.
 Like other balanced Binary Search Trees, time complexity to
search, insert and delete is O(log n).
 Insertion of a Node in B-Tree happens only at Leaf Node
 https://www.youtube.com/watch?v=Kn
XohGgIpQU
 http://www.btechsmartclass.com/data_
structures/b-trees.html
B + Tree
 B+ tree is used to store the records very
efficiently by storing the records in an indexed
manner using the B+ tree indexed structure. Due
to the multi-level indexing, the data accessing
becomes faster and easier
 In the B+ tree, keys are the indexes stored in the
internal nodes and records are stored in the leaf
nodes.
Properties
 All leaves are at the same level.
 The root has at least two children.
 Each node except root can have a
maximum of m children and at least m /2
children.
 Each node can contain a maximum of m - 1
keys and a minimum of ⌈m/2⌉ - 1 keys.
 https://www.javatpoint.com/b-tree-vs-
bplus-tree
 https://www.youtube.com/watch?v=jpS
8BLb8BgI
Heaps
 A Heap is a special Tree-based data
structure in which the tree is a
complete binary tree
Types
1. Max heap
2. Min heap
Heap types & Trees
Applications
 Heap Implemented priority queues are
used in Graph algorithms like Prim’s
Algorithm (minimum spanning tree)
and Dijkstra’s algorithm(shortest path)
 Heap sort
 Huffman encoding(data compression)
Heap types & Trees

More Related Content

PPTX
Data structures
PPT
data structures
PPT
Struktur data ppt
PPSX
Data Structure # vpmp polytechnic
PPTX
Data structures Lecture no.3
PPT
Data struters
PPTX
Tree data structure in java
PPT
Elementary data organisation
Data structures
data structures
Struktur data ppt
Data Structure # vpmp polytechnic
Data structures Lecture no.3
Data struters
Tree data structure in java
Elementary data organisation

What's hot (20)

PPT
Data structures and Alogarithims
PPTX
Data structure (basics)
PPTX
Data structures Lecture no. 2
PPS
Database
PPTX
Data structures lectures no 1
PPT
Lecture 1 data structures and algorithms
PPTX
Introduction To Data Structures.
PPTX
Tree(Data Structure)
PDF
PPTX
Presentation on Data Structure
PPTX
Introduction of Data Structure
PPTX
B trees
DOCX
Data structures notes
PPT
Entities and attributes
PPT
Intro ds
PPT
Introduction to data structure
PDF
PPTX
Data Structures - Lecture 2 [Introduction to Data Structures]
PPTX
Data structure day5
PPT
Chapter 1( intro & overview)
Data structures and Alogarithims
Data structure (basics)
Data structures Lecture no. 2
Database
Data structures lectures no 1
Lecture 1 data structures and algorithms
Introduction To Data Structures.
Tree(Data Structure)
Presentation on Data Structure
Introduction of Data Structure
B trees
Data structures notes
Entities and attributes
Intro ds
Introduction to data structure
Data Structures - Lecture 2 [Introduction to Data Structures]
Data structure day5
Chapter 1( intro & overview)
Ad

Similar to Heap types & Trees (20)

PDF
Binary search tree with pre-order inorder and postorder
PPTX
Binary trees1
PDF
unit-2-dsa-tree introduction of tree and terninology
PDF
Difference between complete,ordered,full,strict,perfect and balanced binary tree
PPTX
BST binary search tree with tree traversals.pptx
PPTX
unit-2-data structure and algorithms-tree-2024-1.pptx
PDF
A41001011
PPTX
4. Apply data structures such as arrays, linked lists, and trees as an abstra...
PPTX
data structures module III & IV.pptx
PPTX
TREE PRESENTATION COMPUTER SCIENCE/DATA STRUCTURE
PPTX
BST.pptx this isp used for learning binary search trees
PPTX
BST.pptx this is Good for data structure
PDF
B Trees and B+ Trees Data structures in Computer Sciences
PPTX
types of trees1234567890qwertyuiopasdfg.pptx
PPTX
Unit 5 Tree.pptx
PPTX
Saikat techhnology of techtechhnology of techGhorai.pptx
PDF
Furnish an Index Using the Works of Tree Structures
PDF
B TREE ( a to z concept ) in data structure or DBMS
PPTX
Index Structures.pptx
PDF
unit-2-dsa-tree-2024-1 (1) (1).pdf data structure
Binary search tree with pre-order inorder and postorder
Binary trees1
unit-2-dsa-tree introduction of tree and terninology
Difference between complete,ordered,full,strict,perfect and balanced binary tree
BST binary search tree with tree traversals.pptx
unit-2-data structure and algorithms-tree-2024-1.pptx
A41001011
4. Apply data structures such as arrays, linked lists, and trees as an abstra...
data structures module III & IV.pptx
TREE PRESENTATION COMPUTER SCIENCE/DATA STRUCTURE
BST.pptx this isp used for learning binary search trees
BST.pptx this is Good for data structure
B Trees and B+ Trees Data structures in Computer Sciences
types of trees1234567890qwertyuiopasdfg.pptx
Unit 5 Tree.pptx
Saikat techhnology of techtechhnology of techGhorai.pptx
Furnish an Index Using the Works of Tree Structures
B TREE ( a to z concept ) in data structure or DBMS
Index Structures.pptx
unit-2-dsa-tree-2024-1 (1) (1).pdf data structure
Ad

More from LavanyaJ28 (16)

DOCX
Cs1301 syllabus
DOCX
Ds important questions
DOC
2 marks- DS using python
PPTX
Searching,sorting
PPTX
Hashing
PPT
Graphs
PPTX
Unit 3 trees
PPTX
Unit ii linear data structures
PPTX
Unit ii linear data structures
PPTX
Unit 2 application of stack
PPTX
Stack and queue
PPT
Unit 1 linked list
PPTX
Unit 1 Basic concepts to DS
PPTX
Unit 1 array based implementation
PPTX
Unit 1 polynomial manipulation
PPTX
Unit 1 abstract data types
Cs1301 syllabus
Ds important questions
2 marks- DS using python
Searching,sorting
Hashing
Graphs
Unit 3 trees
Unit ii linear data structures
Unit ii linear data structures
Unit 2 application of stack
Stack and queue
Unit 1 linked list
Unit 1 Basic concepts to DS
Unit 1 array based implementation
Unit 1 polynomial manipulation
Unit 1 abstract data types

Recently uploaded (20)

PDF
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
PPTX
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
PDF
Visual Aids for Exploratory Data Analysis.pdf
PPTX
Information Storage and Retrieval Techniques Unit III
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Artificial Intelligence
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PPTX
Fundamentals of Mechanical Engineering.pptx
PDF
737-MAX_SRG.pdf student reference guides
PDF
Soil Improvement Techniques Note - Rabbi
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PDF
Abrasive, erosive and cavitation wear.pdf
PPTX
communication and presentation skills 01
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
distributed database system" (DDBS) is often used to refer to both the distri...
PPTX
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
PPTX
Management Information system : MIS-e-Business Systems.pptx
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
Visual Aids for Exploratory Data Analysis.pdf
Information Storage and Retrieval Techniques Unit III
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
Automation-in-Manufacturing-Chapter-Introduction.pdf
Artificial Intelligence
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Fundamentals of Mechanical Engineering.pptx
737-MAX_SRG.pdf student reference guides
Soil Improvement Techniques Note - Rabbi
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
Fundamentals of safety and accident prevention -final (1).pptx
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Abrasive, erosive and cavitation wear.pdf
communication and presentation skills 01
Safety Seminar civil to be ensured for safe working.
distributed database system" (DDBS) is often used to refer to both the distri...
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
Management Information system : MIS-e-Business Systems.pptx

Heap types & Trees

  • 2. AVL trees  AVL trees are binary search trees in which the difference between the height of the left and right subtree is either -1, 0, or +1.  AVL trees are also called a self-balancing binary search tree. These trees help to maintain the logarithmic search time. It is named after its inventors (AVL) Adelson, Velsky, and Landis.  Balance Factor = (Height of Left Subtree - Height of Right Subtree)  https://www.javatpoint.com/insertion-in-avl-tree
  • 3. Rotations  Left – Left Rotation  Right – Right Rotation  Right – Left Rotation  Left – Right Rotation  https://www.tutorialspoint.com/data_str uctures_algorithms/avl_tree_algorithm .htm
  • 6. Advantages of AVL Trees  The height of the AVL tree is always balanced. The height never grows beyond log N, where N is the total number of nodes in the tree.  It gives better search time complexity when compared to simple Binary Search trees.  AVL trees have self-balancing capabilities.
  • 7. B Tree  B Trees is similar to that in Binary search tree  B-Tree is a self-balanced search tree in which every node contains multiple keys and has more than two children. Operations  Insertion  Deletion  Search
  • 8. Properties  All leaves are at the same level.  A B-Tree is defined by the term minimum degree ‘t’. The value of t depends upon disk block size.  Every node except root must contain at least (ceiling)([t-1]/2) keys. The root may contain minimum 1 key.  All nodes (including root) may contain at most t – 1 keys.  Number of children of a node is equal to the number of keys in it plus 1.  All keys of a node are sorted in increasing order. The child between two keys k1 and k2 contains all keys in the range from k1 and k2.  B-Tree grows and shrinks from the root which is unlike Binary Search Tree. Binary Search Trees grow downward and also shrink from downward.  Like other balanced Binary Search Trees, time complexity to search, insert and delete is O(log n).  Insertion of a Node in B-Tree happens only at Leaf Node
  • 10. B + Tree  B+ tree is used to store the records very efficiently by storing the records in an indexed manner using the B+ tree indexed structure. Due to the multi-level indexing, the data accessing becomes faster and easier  In the B+ tree, keys are the indexes stored in the internal nodes and records are stored in the leaf nodes.
  • 11. Properties  All leaves are at the same level.  The root has at least two children.  Each node except root can have a maximum of m children and at least m /2 children.  Each node can contain a maximum of m - 1 keys and a minimum of ⌈m/2⌉ - 1 keys.
  • 13. Heaps  A Heap is a special Tree-based data structure in which the tree is a complete binary tree Types 1. Max heap 2. Min heap
  • 15. Applications  Heap Implemented priority queues are used in Graph algorithms like Prim’s Algorithm (minimum spanning tree) and Dijkstra’s algorithm(shortest path)  Heap sort  Huffman encoding(data compression)