SlideShare a Scribd company logo
1 of 15
Download to read offline
BABA GHULAM SHAH BADSHAH
UNIVERSITY- RAJOURI (J&K).
DEPARTMENT OF COMPUTER
SCIENCES
PRESENTATION TOPIC:-
PRESENTED BY:-
Ajeela Mushtaq Roll NO:-13-Mcs-15
PRESENTED TO:-
MUZAFAR AHMAD DAR
CONCEPT OF AVL TREE AND B-TREE
AVL Tree
• AVL tree was introduced by Russian
Mathematicians G.M. Adelson- Velskii and E. M.
Landis in 1962.
• It’s a binary tree in which the height of left sub tree
to the height of right sub tree differs at most by 1.
This difference is called Balance Factor.
• Here we see that the first tree is balanced and next
two trees are not balanced −
• In second tree, the left sub tree of C has height 2 and
right sub tree has height 0, so the difference is 2. In third
tree, the right sub tree of A has height 2 and left is
missing, so it is 0, and the difference is 2 again. AVL tree
permits difference (balance factor) to be only 1.
Balance Factor = height(left-sub tree) − height(right-sub
tree)
• If the difference in the height of left and right sub-trees is
more than 1, the tree is balanced using some rotation
techniques.
B-Tree
• The trees discussed already contain only one
key information in each node.
• If the nodes have two links then they are binary
trees.
• If more than two links generate from the node
then it is multi way tree.
• The concept of B-Tree was developed by two scientists
Bayer and Crugit in 1972.
• A multi-way balanced tree is called as B-Tree. Each node
in a B-Tree contains more than one key information in an
order, either in ascending or descending.
• B-Tree is not a binary tree.
Contd…
• It grows from bottom to top rather than top
to bottom .
• Because of the multi-ways the B-Tree is
also called as m-way tree.
PROPERTIES:
• Each node has maximum of m-1 keys.
• Each node has a maximum of ‘m’ links, means they
can have maximum of ‘m’ children.
• Each node contains keys in order.
• All the leaves will be at same level.
• If a node contains m-1 keys then it is said to be full.
In a full node if key is added, then the node will be
split at median key value and the median will move
to root or as a value in root. So, the node is split into
leaves and root.
Contd…
• The insertion is always done at the leaves.
• Root node of B-Tree should contain at-least one key.
Example of B-Tree
• Design a B-Tree of order 5 from
the following list of numbers ?
12,32,8,18,34,21,11,10,9,20
Solution..
• As the order of B-tree is 5 ,we can store maximum of
4 numbers in each node. The maximum links of any
node will be 5.
• The first number 12 is inserted into an empty node
of a B-Tree.
• The next number 32 is added to the node after 12 .
Similarly 8 is added to the node before 12 and 18 is
added after 12.
12
Contd…
• After three insertions the B-Tree will be.
• When 34 is added to the node , the node will be full
and needs a split . The node is split at median 18
and a root node with key (number) 18 is created and
two leaves are formed. So, the B-Tree after insertion
will be
8 12 18 32
18
32
34
8 12
Contd…
• The next no. 21 is added to the right child (before 32)
of 18 because 21 is greater than 18.the next no. 11
is added to the left child of 18(between 8 and 12).
Similarly the next no. 10 is added to the left child of
18(between 8 and 11). The B-Tree after these two
insertion is:
18
8 10 11 12 21 32 34
Contd…
• When the next no.9 is to b added to the B-Tree it is
supposed to be added to the left child of 18. As the
left child will be full after this addition the node will
be split. The median 10 will be moved to root . The
next no. 20 is added to the right child of 18 (before
21). After this the B-Tree will be:
10 18
8 9 11 12 20 21 32 34
THANK YOU !!!

More Related Content

What's hot (16)

2 30 Data Collection
2 30 Data Collection2 30 Data Collection
2 30 Data Collection
 
Matrices
MatricesMatrices
Matrices
 
1.1 real number system dfs
1.1 real number system dfs1.1 real number system dfs
1.1 real number system dfs
 
Real Number System
Real Number SystemReal Number System
Real Number System
 
Lesson 1 introduction
Lesson 1   introductionLesson 1   introduction
Lesson 1 introduction
 
1.2 subsets of integers dfs
1.2 subsets of integers dfs1.2 subsets of integers dfs
1.2 subsets of integers dfs
 
Lesson 2 number systems
Lesson 2  number systemsLesson 2  number systems
Lesson 2 number systems
 
Densityof numberline
Densityof numberlineDensityof numberline
Densityof numberline
 
Numbers
NumbersNumbers
Numbers
 
B and B+ tree
B and B+ treeB and B+ tree
B and B+ tree
 
Real numbers ppt
Real numbers pptReal numbers ppt
Real numbers ppt
 
B-Tree
B-TreeB-Tree
B-Tree
 
Matrix (BBA, MBA)
Matrix (BBA, MBA)Matrix (BBA, MBA)
Matrix (BBA, MBA)
 
ECE203 Lecture 5, 6
ECE203 Lecture 5, 6ECE203 Lecture 5, 6
ECE203 Lecture 5, 6
 
Numbers ok1296542354
Numbers   ok1296542354Numbers   ok1296542354
Numbers ok1296542354
 
Documents and formatting
Documents and formattingDocuments and formatting
Documents and formatting
 

Similar to AVL and B-Tree Structures

Similar to AVL and B-Tree Structures (20)

Tree
TreeTree
Tree
 
Lecture-7-Binary-Trees-and-Algorithms-11052023-054009pm.pptx
Lecture-7-Binary-Trees-and-Algorithms-11052023-054009pm.pptxLecture-7-Binary-Trees-and-Algorithms-11052023-054009pm.pptx
Lecture-7-Binary-Trees-and-Algorithms-11052023-054009pm.pptx
 
BINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.pptBINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.ppt
 
LEC 5-DS ALGO(updated).pdf
LEC 5-DS  ALGO(updated).pdfLEC 5-DS  ALGO(updated).pdf
LEC 5-DS ALGO(updated).pdf
 
358 33 powerpoint-slides_10-trees_chapter-10
358 33 powerpoint-slides_10-trees_chapter-10358 33 powerpoint-slides_10-trees_chapter-10
358 33 powerpoint-slides_10-trees_chapter-10
 
Data structure tree - intermediate
Data structure tree - intermediateData structure tree - intermediate
Data structure tree - intermediate
 
Btree
BtreeBtree
Btree
 
Unit 6 tree
Unit   6 treeUnit   6 tree
Unit 6 tree
 
Data structure using c module 2
Data structure using c module 2Data structure using c module 2
Data structure using c module 2
 
Lecture 5 tree.pptx
Lecture 5 tree.pptxLecture 5 tree.pptx
Lecture 5 tree.pptx
 
binary tree.pptx
binary tree.pptxbinary tree.pptx
binary tree.pptx
 
Data structure tree- advance
Data structure tree- advanceData structure tree- advance
Data structure tree- advance
 
Module - 5_Trees.pdf
Module - 5_Trees.pdfModule - 5_Trees.pdf
Module - 5_Trees.pdf
 
NON-LINEAR DATA STRUCTURE-TREES.pptx
NON-LINEAR DATA STRUCTURE-TREES.pptxNON-LINEAR DATA STRUCTURE-TREES.pptx
NON-LINEAR DATA STRUCTURE-TREES.pptx
 
Tree.pptx
Tree.pptxTree.pptx
Tree.pptx
 
Unit – vi tree
Unit – vi   treeUnit – vi   tree
Unit – vi tree
 
07 trees
07 trees07 trees
07 trees
 
TREES.pptx
TREES.pptxTREES.pptx
TREES.pptx
 
Multiway Trees.ppt
Multiway Trees.pptMultiway Trees.ppt
Multiway Trees.ppt
 
Best for b trees
Best for b treesBest for b trees
Best for b trees
 

More from ajeela mushtaq (12)

String.ppt
String.pptString.ppt
String.ppt
 
Sets automata
Sets automataSets automata
Sets automata
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Mail merge
Mail mergeMail merge
Mail merge
 
Linux hotspot
Linux hotspotLinux hotspot
Linux hotspot
 
Interfaces .net
Interfaces .netInterfaces .net
Interfaces .net
 
Incremental
IncrementalIncremental
Incremental
 
Gprs
GprsGprs
Gprs
 
Graphics a buffer
Graphics a bufferGraphics a buffer
Graphics a buffer
 
Disk allocation methods
Disk allocation methodsDisk allocation methods
Disk allocation methods
 
Data com prsntation
Data com prsntationData com prsntation
Data com prsntation
 
Dynamic routing
Dynamic routingDynamic routing
Dynamic routing
 

Recently uploaded

100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Delhi Call girls
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一ffjhghh
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxolyaivanovalion
 

Recently uploaded (20)

100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 

AVL and B-Tree Structures

  • 1. BABA GHULAM SHAH BADSHAH UNIVERSITY- RAJOURI (J&K). DEPARTMENT OF COMPUTER SCIENCES PRESENTATION TOPIC:- PRESENTED BY:- Ajeela Mushtaq Roll NO:-13-Mcs-15 PRESENTED TO:- MUZAFAR AHMAD DAR CONCEPT OF AVL TREE AND B-TREE
  • 2. AVL Tree • AVL tree was introduced by Russian Mathematicians G.M. Adelson- Velskii and E. M. Landis in 1962. • It’s a binary tree in which the height of left sub tree to the height of right sub tree differs at most by 1. This difference is called Balance Factor.
  • 3. • Here we see that the first tree is balanced and next two trees are not balanced −
  • 4. • In second tree, the left sub tree of C has height 2 and right sub tree has height 0, so the difference is 2. In third tree, the right sub tree of A has height 2 and left is missing, so it is 0, and the difference is 2 again. AVL tree permits difference (balance factor) to be only 1. Balance Factor = height(left-sub tree) − height(right-sub tree) • If the difference in the height of left and right sub-trees is more than 1, the tree is balanced using some rotation techniques.
  • 5. B-Tree • The trees discussed already contain only one key information in each node. • If the nodes have two links then they are binary trees. • If more than two links generate from the node then it is multi way tree.
  • 6. • The concept of B-Tree was developed by two scientists Bayer and Crugit in 1972. • A multi-way balanced tree is called as B-Tree. Each node in a B-Tree contains more than one key information in an order, either in ascending or descending. • B-Tree is not a binary tree.
  • 7. Contd… • It grows from bottom to top rather than top to bottom . • Because of the multi-ways the B-Tree is also called as m-way tree.
  • 8. PROPERTIES: • Each node has maximum of m-1 keys. • Each node has a maximum of ‘m’ links, means they can have maximum of ‘m’ children. • Each node contains keys in order. • All the leaves will be at same level. • If a node contains m-1 keys then it is said to be full. In a full node if key is added, then the node will be split at median key value and the median will move to root or as a value in root. So, the node is split into leaves and root.
  • 9. Contd… • The insertion is always done at the leaves. • Root node of B-Tree should contain at-least one key.
  • 10. Example of B-Tree • Design a B-Tree of order 5 from the following list of numbers ? 12,32,8,18,34,21,11,10,9,20
  • 11. Solution.. • As the order of B-tree is 5 ,we can store maximum of 4 numbers in each node. The maximum links of any node will be 5. • The first number 12 is inserted into an empty node of a B-Tree. • The next number 32 is added to the node after 12 . Similarly 8 is added to the node before 12 and 18 is added after 12. 12
  • 12. Contd… • After three insertions the B-Tree will be. • When 34 is added to the node , the node will be full and needs a split . The node is split at median 18 and a root node with key (number) 18 is created and two leaves are formed. So, the B-Tree after insertion will be 8 12 18 32 18 32 34 8 12
  • 13. Contd… • The next no. 21 is added to the right child (before 32) of 18 because 21 is greater than 18.the next no. 11 is added to the left child of 18(between 8 and 12). Similarly the next no. 10 is added to the left child of 18(between 8 and 11). The B-Tree after these two insertion is: 18 8 10 11 12 21 32 34
  • 14. Contd… • When the next no.9 is to b added to the B-Tree it is supposed to be added to the left child of 18. As the left child will be full after this addition the node will be split. The median 10 will be moved to root . The next no. 20 is added to the right child of 18 (before 21). After this the B-Tree will be: 10 18 8 9 11 12 20 21 32 34