SlideShare a Scribd company logo
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

data structure(tree operations)
data structure(tree operations)data structure(tree operations)
data structure(tree operations)
Waheed Khalid
 
Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures
Gurukul Kangri Vishwavidyalaya - Faculty of Engineering and Technology
 
Binary tree
Binary treeBinary tree
Binary tree
Rajendran
 
Tree-In Data Structure
Tree-In Data StructureTree-In Data Structure
Tree-In Data Structure
United International University
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
Anand Ingle
 
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
Tree Data Structure by Daniyal Khan
Tree Data Structure by Daniyal KhanTree Data Structure by Daniyal Khan
Tree Data Structure by Daniyal Khan
Daniyal Khan
 
BINARY SEARCH TREE
BINARY SEARCH TREE BINARY SEARCH TREE
BINARY SEARCH TREE
Usha Mahalingam
 
AVL Tree in Data Structure
AVL Tree in Data Structure AVL Tree in Data Structure
AVL Tree in Data Structure
Vrushali Dhanokar
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
ManishPrajapati78
 
linked list
linked listlinked list
linked list
Shaista Qadir
 
Data Structure and Algorithms AVL Trees
Data Structure and Algorithms AVL TreesData Structure and Algorithms AVL Trees
Data Structure and Algorithms AVL Trees
ManishPrajapati78
 
Hashing
HashingHashing
Hashing
Amar Jukuntla
 
Avl trees
Avl treesAvl trees
Avl trees
amna izzat
 
Segment tree
Segment treeSegment tree
Segment tree
Sindhuja Kumar
 
Heap tree
Heap treeHeap tree
Heap tree
JananiJ19
 
Red black tree
Red black treeRed black tree
Red black tree
Dr Sandeep Kumar Poonia
 
Types of Tree in Data Structure in C++
Types of Tree in Data Structure in C++Types of Tree in Data Structure in C++
Types of Tree in Data Structure in C++
Himanshu Choudhary
 

What's hot (20)

data structure(tree operations)
data structure(tree operations)data structure(tree operations)
data structure(tree operations)
 
Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures
 
Binary tree
Binary treeBinary tree
Binary tree
 
Tree-In Data Structure
Tree-In Data StructureTree-In Data Structure
Tree-In Data Structure
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
 
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
 
Tree Data Structure by Daniyal Khan
Tree Data Structure by Daniyal KhanTree Data Structure by Daniyal Khan
Tree Data Structure by Daniyal Khan
 
BINARY SEARCH TREE
BINARY SEARCH TREE BINARY SEARCH TREE
BINARY SEARCH TREE
 
AVL Tree in Data Structure
AVL Tree in Data Structure AVL Tree in Data Structure
AVL Tree in Data Structure
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
 
Binomial heaps
Binomial heapsBinomial heaps
Binomial heaps
 
linked list
linked listlinked list
linked list
 
Data Structure and Algorithms AVL Trees
Data Structure and Algorithms AVL TreesData Structure and Algorithms AVL Trees
Data Structure and Algorithms AVL Trees
 
Hashing
HashingHashing
Hashing
 
b+ tree
b+ treeb+ tree
b+ tree
 
Avl trees
Avl treesAvl trees
Avl trees
 
Segment tree
Segment treeSegment tree
Segment tree
 
Heap tree
Heap treeHeap tree
Heap tree
 
Red black tree
Red black treeRed black tree
Red black tree
 
Types of Tree in Data Structure in C++
Types of Tree in Data Structure in C++Types of Tree in Data Structure in C++
Types of Tree in Data Structure in C++
 

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.ppt
ssuser19bb13
 
Nikhat b+ trees ppt
Nikhat b+ trees pptNikhat b+ trees ppt
Nikhat b+ trees ppt
Nikihat Maniyar
 
Trees
TreesTrees
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
MathkeBhoot
 
Indexing.ppt
Indexing.pptIndexing.ppt
Indexing.ppt
KalsoomTahir2
 
Indexing.ppt mmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Indexing.ppt mmmmmmmmmmmmmmmmmmmmmmmmmmmmmIndexing.ppt mmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Indexing.ppt mmmmmmmmmmmmmmmmmmmmmmmmmmmmm
RAtna29
 
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
ssuser19bb13
 
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
 
Lecture notes data structures tree
Lecture notes data structures   treeLecture notes data structures   tree
Lecture notes data structures tree
maamir farooq
 
trees
trees trees
B+tree
B+treeB+tree
B+tree
jasscheema
 
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
MalligaarjunanN
 
B trees and_b__trees
B trees and_b__treesB trees and_b__trees
B trees and_b__trees
meghu123
 
Balance tree. Short overview
Balance tree. Short overviewBalance tree. Short overview
Balance tree. Short overview
ElifTech
 
Data structure tree - intermediate
Data structure tree - intermediateData structure tree - intermediate
Data structure tree - intermediate
MD. 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 tree
B treeB tree
B tree
 
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-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
 
Lecture notes data structures tree
Lecture notes data structures   treeLecture notes data structures   tree
Lecture notes data structures tree
 
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
 

Recently uploaded

Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 

Recently uploaded (20)

Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 

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