SlideShare a Scribd company logo
1 of 46
Balanced Trees   (B and B+)
Completely Balanced Trees ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
B-Trees ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
B-Trees ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
B-Tree Definition ,[object Object],[object Object],[object Object],[object Object]
Multi-way Search Tree of order of 4 Keys Pointers
B-Trees
B-Tree Properties ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
B-Tree Properties 4.  Each leaf node (other than the root node if it is a leaf)    must contain at least   (m / 2)    - 1 keys.  Note:  x   is the ceiling function whose value is the smallest integer that  is greater than or equal to x. E.g.,     3    = 3    3.34   = 4    1.98    = 2    5.001    = 6
B-Tree Properties A B-tree is a fairly well-balanced tree since all leaf nodes must be at  the bottom.  Recall condition 2. All internal nodes (except perhaps the root node) have at least     (m / 2)    (nonempty) children    keep it bushy and balanced. Causes the tree to  fan out , i.e., shorter height
B-Tree Insertion ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Insertion Example Insert the following letters into what is originally an empty B-tree of order 5:  C N G A H E K Q M F W L T Z D P R X Y S  Order 5    max of 5 children and 4 keys. All nodes (except root) must have a minimum of 2 keys. Inserting in alphabetical order the first 4  letters:
Insertion Example Insert H next.  No room.  Split into 2 nodes.  Move median item G up into new root node Insert EKQ next
Insertion Example C N G A H   E K Q M  F W L T Z D P R X Y S Inserting E, K, & Q doesn’t require splits. But inserting M does ??  - split into 2
Insertion Example C N G A H E K Q M   F W L T  Z D P R X Y S F, W, L, and T are then added without needing any split.
Insertion Example C N G A H E K Q M   F W L T Z  D P R X Y S F, W, L, and T are then added without needing any split.   Adding Z requires node to split Move median (T) up & split node
Insertion Example Z
C N G A H E K Q M F W L T Z  D P R X Y S D (which is the median too) Insert PRXY without any splitting
C N G A H E K Q M F W L T Z   D P R X Y  S ,[object Object],[object Object],[object Object]
B Tree Deletion ,[object Object],[object Object],[object Object]
B Tree Deletion ,[object Object]
B Tree Deletion ,[object Object],[object Object]
B Tree Deletion ,[object Object],[object Object],[object Object],[object Object],α β γ
B Tree Deletion
B Tree Deletion - Delete E next - Very problematic    siblings as well as E has no extra keys - Combine the leaf with one of two siblings - Move down parent’s key that was between these two siblings
B Tree (Delete E)
B Tree Deletion ,[object Object],[object Object],[object Object]
B Tree Deletion
B+ Trees
B+-Tree ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
B+-Trees ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
B+-Tree Example ,[object Object],[object Object]
B+-Tree Insertions ,[object Object],[object Object]
The insert algorithm for B+ Trees Leaf Page Full Index Page FULL Action No No Place the record in sorted position in the appropriate leaf page Yes No ,[object Object],[object Object],[object Object],[object Object]
The insert algorithm for B+ Trees Leaf Page Full Index Page FULL Action Yes Yes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Insertion Example Adding record with Key 28:
Insertion Example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Insert (Leaf full; index not) 70
Insert (Leaf and index pages are full) Add 95    belongs here Split leaf page into 2:  75  80  and  85  90  95 Middle key (85) goes up    parent is full    split parent 25  50  60    75  85 Middle key (60) made a new parent of the parents
Insert (Leaf and index pages are full) 95
Rotation When a leaf node is full and its sibling is not. Reduce number of page splits. E.g., add 70    previously, we split the  50  55  60  65 node and brought 60 up Instead, move a record to its sibling:
The delete algorithm for B+ Trees Leaf Page Below Fill Factor Index Page Below Fill Factor Action No  No Delete the record from the leaf page. Arrange keys in ascending order to fill void. If the key of the deleted record appears in the index page, use the next key to replace it. Yes No Combine the leaf page and its sibling. Change the index page to reflect the change.  Yes Yes ,[object Object],[object Object],[object Object]
Deletion Example Delete 70:  OK since fill factor = 50% (min# records in a node)
Deletion Example Now delete 25:  Leaf: OK (fill factor satisfied) Index: not OK    replace with 28
Deletion Example Delete 60:  fill factor < 50%    combine leaf pages and index pages
Deletion Example

More Related Content

What's hot (20)

Multi ways trees
Multi ways treesMulti ways trees
Multi ways trees
 
Binary search tree(bst)
Binary search tree(bst)Binary search tree(bst)
Binary search tree(bst)
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
10.m way search tree
10.m way search tree10.m way search tree
10.m way search tree
 
B tree
B  treeB  tree
B tree
 
K map.
K map.K map.
K map.
 
Red black tree
Red black treeRed black tree
Red black tree
 
Introduction to tree ds
Introduction to tree dsIntroduction to tree ds
Introduction to tree ds
 
Insertion in singly linked list
Insertion in singly linked listInsertion in singly linked list
Insertion in singly linked list
 
Hashing
HashingHashing
Hashing
 
Data Structures - Searching & sorting
Data Structures - Searching & sortingData Structures - Searching & sorting
Data Structures - Searching & sorting
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Queue
QueueQueue
Queue
 
Trees (data structure)
Trees (data structure)Trees (data structure)
Trees (data structure)
 
AVL Tree in Data Structure
AVL Tree in Data Structure AVL Tree in Data Structure
AVL Tree in Data Structure
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Tree and Binary Search tree
Tree and Binary Search treeTree and Binary Search tree
Tree and Binary Search tree
 
Lecture notes data structures tree
Lecture notes data structures   treeLecture notes data structures   tree
Lecture notes data structures tree
 
B+ Tree
B+ TreeB+ Tree
B+ Tree
 

Similar to Best for b trees

109885098-B-Trees-And-B-Trees in data structure.ppt
109885098-B-Trees-And-B-Trees in data structure.ppt109885098-B-Trees-And-B-Trees in data structure.ppt
109885098-B-Trees-And-B-Trees in data structure.pptssuser19bb13
 
B TREE ( a to z concept ) in data structure or DBMS
B TREE ( a to z concept ) in data structure  or DBMSB TREE ( a to z concept ) in data structure  or DBMS
B TREE ( a to z concept ) in data structure or DBMSMathkeBhoot
 
Indexing.ppt mmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Indexing.ppt mmmmmmmmmmmmmmmmmmmmmmmmmmmmmIndexing.ppt mmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Indexing.ppt mmmmmmmmmmmmmmmmmmmmmmmmmmmmmRAtna29
 
B-and-B-Tree-ppt presentation in data structure
B-and-B-Tree-ppt presentation in data structureB-and-B-Tree-ppt presentation in data structure
B-and-B-Tree-ppt presentation in data structuressuser19bb13
 
presentation on b tress. heap trees.hashing
presentation on b tress. heap trees.hashingpresentation on b tress. heap trees.hashing
presentation on b tress. heap trees.hashingBindiya syed
 
Data structures trees - B Tree & B+Tree.pptx
Data structures trees - B Tree & B+Tree.pptxData structures trees - B Tree & B+Tree.pptx
Data structures trees - B Tree & B+Tree.pptxMalligaarjunanN
 
B trees and_b__trees
B trees and_b__treesB trees and_b__trees
B trees and_b__treesmeghu123
 
Balance tree. Short overview
Balance tree. Short overviewBalance tree. Short overview
Balance tree. Short overviewElifTech
 
Data structure tree - intermediate
Data structure tree - intermediateData structure tree - intermediate
Data structure tree - intermediateMD. MARUFUZZAMAN .
 

Similar to Best for b trees (20)

109885098-B-Trees-And-B-Trees in data structure.ppt
109885098-B-Trees-And-B-Trees in data structure.ppt109885098-B-Trees-And-B-Trees in data structure.ppt
109885098-B-Trees-And-B-Trees in data structure.ppt
 
Nikhat b+ trees ppt
Nikhat b+ trees pptNikhat b+ trees ppt
Nikhat b+ trees ppt
 
Trees
TreesTrees
Trees
 
B trees dbms
B trees dbmsB trees dbms
B trees dbms
 
Btree
BtreeBtree
Btree
 
B TREE ( a to z concept ) in data structure or DBMS
B TREE ( a to z concept ) in data structure  or DBMSB TREE ( a to z concept ) in data structure  or DBMS
B TREE ( a to z concept ) in data structure or DBMS
 
Unit 3.ppt
Unit 3.pptUnit 3.ppt
Unit 3.ppt
 
Indexing.ppt
Indexing.pptIndexing.ppt
Indexing.ppt
 
Indexing.ppt mmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Indexing.ppt mmmmmmmmmmmmmmmmmmmmmmmmmmmmmIndexing.ppt mmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Indexing.ppt mmmmmmmmmmmmmmmmmmmmmmmmmmmmm
 
B+ trees and height balance tree
B+ trees and height balance treeB+ trees and height balance tree
B+ trees and height balance tree
 
B-and-B-Tree-ppt presentation in data structure
B-and-B-Tree-ppt presentation in data structureB-and-B-Tree-ppt presentation in data structure
B-and-B-Tree-ppt presentation in data structure
 
presentation on b tress. heap trees.hashing
presentation on b tress. heap trees.hashingpresentation on b tress. heap trees.hashing
presentation on b tress. heap trees.hashing
 
trees
trees trees
trees
 
B+tree
B+treeB+tree
B+tree
 
Data structures trees - B Tree & B+Tree.pptx
Data structures trees - B Tree & B+Tree.pptxData structures trees - B Tree & B+Tree.pptx
Data structures trees - B Tree & B+Tree.pptx
 
B trees and_b__trees
B trees and_b__treesB trees and_b__trees
B trees and_b__trees
 
Balance tree. Short overview
Balance tree. Short overviewBalance tree. Short overview
Balance tree. Short overview
 
Data structure tree - intermediate
Data structure tree - intermediateData structure tree - intermediate
Data structure tree - intermediate
 
08 B Trees
08 B Trees08 B Trees
08 B Trees
 
Tree.pptx
Tree.pptxTree.pptx
Tree.pptx
 

Recently uploaded

Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 

Recently uploaded (20)

Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 

Best for b trees

  • 1. Balanced Trees (B and B+)
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. Multi-way Search Tree of order of 4 Keys Pointers
  • 8.
  • 9. B-Tree Properties 4. Each leaf node (other than the root node if it is a leaf) must contain at least  (m / 2)  - 1 keys. Note:  x  is the ceiling function whose value is the smallest integer that is greater than or equal to x. E.g.,  3  = 3  3.34  = 4  1.98  = 2  5.001  = 6
  • 10. B-Tree Properties A B-tree is a fairly well-balanced tree since all leaf nodes must be at the bottom. Recall condition 2. All internal nodes (except perhaps the root node) have at least  (m / 2)  (nonempty) children  keep it bushy and balanced. Causes the tree to fan out , i.e., shorter height
  • 11.
  • 12. Insertion Example Insert the following letters into what is originally an empty B-tree of order 5: C N G A H E K Q M F W L T Z D P R X Y S Order 5  max of 5 children and 4 keys. All nodes (except root) must have a minimum of 2 keys. Inserting in alphabetical order the first 4 letters:
  • 13. Insertion Example Insert H next. No room. Split into 2 nodes. Move median item G up into new root node Insert EKQ next
  • 14. Insertion Example C N G A H E K Q M F W L T Z D P R X Y S Inserting E, K, & Q doesn’t require splits. But inserting M does ?? - split into 2
  • 15. Insertion Example C N G A H E K Q M F W L T Z D P R X Y S F, W, L, and T are then added without needing any split.
  • 16. Insertion Example C N G A H E K Q M F W L T Z D P R X Y S F, W, L, and T are then added without needing any split. Adding Z requires node to split Move median (T) up & split node
  • 18. C N G A H E K Q M F W L T Z D P R X Y S D (which is the median too) Insert PRXY without any splitting
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 25. B Tree Deletion - Delete E next - Very problematic  siblings as well as E has no extra keys - Combine the leaf with one of two siblings - Move down parent’s key that was between these two siblings
  • 27.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. Insertion Example Adding record with Key 28:
  • 37.
  • 38. Insert (Leaf full; index not) 70
  • 39. Insert (Leaf and index pages are full) Add 95  belongs here Split leaf page into 2: 75 80 and 85 90 95 Middle key (85) goes up  parent is full  split parent 25 50 60 75 85 Middle key (60) made a new parent of the parents
  • 40. Insert (Leaf and index pages are full) 95
  • 41. Rotation When a leaf node is full and its sibling is not. Reduce number of page splits. E.g., add 70  previously, we split the 50 55 60 65 node and brought 60 up Instead, move a record to its sibling:
  • 42.
  • 43. Deletion Example Delete 70: OK since fill factor = 50% (min# records in a node)
  • 44. Deletion Example Now delete 25: Leaf: OK (fill factor satisfied) Index: not OK  replace with 28
  • 45. Deletion Example Delete 60: fill factor < 50%  combine leaf pages and index pages