SlideShare a Scribd company logo
1 of 23
 Large degree B-trees used to represent very large
dictionaries that reside on disk.
 Smaller degree B-trees used for internal-memory
dictionaries to overcome cache-miss penalties.
 Definition assumes external nodes (extended
m-way search tree).
 B-tree of order m.
◦ m-way search tree.
◦ Not empty => root has at least 2 children.
◦ Remaining internal nodes (if any) have at least
ceil(m/2) children.
◦ External (or failure) nodes on same level.
 B-tree of order m.
◦ m-way search tree.
◦ Not empty => root has at least 2 children.
◦ Remaining internal nodes (if any) have at least
ceil(m/2) children.
◦ External (or failure) nodes on same level.
• 2-3 tree is B-tree of order 3.
• 2-3-4 tree is B-tree of order 4.
 B-tree of order m.
◦ m-way search tree.
◦ Not empty => root has at least 2 children.
◦ Remaining internal nodes (if any) have at least
ceil(m/2) children.
◦ External (or failure) nodes on same level.
• B-tree of order 5 is 3-4-5 tree (root may be
2-node though).
• B-tree of order 2 is full binary tree.
 n = # of pairs.
 # of external nodes = n + 1.
 Height = h => external nodes on level h + 1.
1 1
2 >= 2
3 >= 2*ceil(m/2)
h + 1 >= 2*ceil(m/2)h-1
n + 1 >= 2*ceil(m/2)h-1
, h >= 1
level # of nodes
 m = 200.
n + 1 >= 2*ceil(m/2)h-1
, h >= 1
height # of pairs
2 >= 199
3 >= 19,999
4 >= 2 * 106
–1
5 >= 2 * 108
–1
h <= log ceil(m/2) [(n+1)/2] + 1
 Worst-case search time.
◦ (time to fetch a node + time to search node) * height
◦ (a + b*m + c * log2m) * h
where a, b and c are constants.
m
search
time
50 400
15 20
8
4
1 3 5 6 30 409
Insertion into a full leaf triggers bottom-up node
splitting pass.
16 17
 ai is a pointer to a subtree.
 pi is a dictionary pair.
m a0 p1 a1 p2 a2 …pm am
ceil(m/2)-1 a0 p1 a1 p2 a2 …pceil(m/2)-1 aceil(m/2)-1
m-ceil(m/2) aceil(m/2) pceil(m/2)+1 aceil(m/2)+1 …pm am
• pceil(m/2) plus pointer to new node is inserted in
parent.
15 20
8
4
1 3 5 6 30 409
• Insert a pair with key = 2.
• New pair goes into a 3-node.
16 17
 Insert new pair so that the 3 keys are in
ascending order.
• Split overflowed node around middle key.
1 2 3
• Insert middle key and pointer to new node
into parent.
1 3
2
15 20
8
4
1 3 5 6 30 409
• Insert a pair with key = 2.
16 17
15 20
8
4
5 6 30 409 16 17
3
1
2
• Insert a pair with key = 2 plus a pointer into parent.
• Now, insert a pair with key = 18.
15 20
8
1
2 4
5 6 30 409 16 173
 Insert new pair so that the 3 keys are in
ascending order.
• Split the overflowed node.
16 17 18
• Insert middle key and pointer to new node
into parent.
1816
17
• Insert a pair with key = 18.
15 20
8
1
2 4
5 6 30 409 16 173
• Insert a pair with key = 17 plus a pointer into parent.
15 20
8
1
2 4
5 6 30 4093
18
16
17
• Insert a pair with key = 17 plus a pointer into parent.
8
1
2 4
5 6 30 4093 16
17
15
18
20
• Now, insert a pair with key = 7.
1
2 4
5 6 30 4093 16
15
18
20
8 17
• Insert a pair with key = 6 plus a pointer into parent.
30 401
2 4
93 16
15
18
20
8 17
5
7
6
• Insert a pair with key = 4 plus a pointer into parent.
30 401 93 16
15
18
20
8 17
6
4
2
5 7
• Insert a pair with key = 8 plus a pointer into parent.
• There is no parent. So, create a new root.
30 40
1
9
3
16
15
18
20
6
8
2
5 7
4
17
• Height increases by 1.
30 401 93 16
15
18
2062
5 7
4 17
8

More Related Content

What's hot (20)

Red black tree
Red black treeRed black tree
Red black tree
 
BINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.pptBINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.ppt
 
Doubly & Circular Linked Lists
Doubly & Circular Linked ListsDoubly & Circular Linked Lists
Doubly & Circular Linked Lists
 
Hashing in datastructure
Hashing in datastructureHashing in datastructure
Hashing in datastructure
 
Threaded Binary Tree
Threaded Binary TreeThreaded Binary Tree
Threaded Binary Tree
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
trees in data structure
trees in data structure trees in data structure
trees in data structure
 
Binary Tree in Data Structure
Binary Tree in Data StructureBinary Tree in Data Structure
Binary Tree in Data Structure
 
Trees (data structure)
Trees (data structure)Trees (data structure)
Trees (data structure)
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutorial
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Quick sort
Quick sortQuick sort
Quick sort
 
Tree Traversal
Tree TraversalTree Traversal
Tree Traversal
 
Avl trees final
Avl trees finalAvl trees final
Avl trees final
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
 
Insertion in singly linked list
Insertion in singly linked listInsertion in singly linked list
Insertion in singly linked list
 
Tree-In Data Structure
Tree-In Data StructureTree-In Data Structure
Tree-In Data Structure
 
Lec 17 heap data structure
Lec 17 heap data structureLec 17 heap data structure
Lec 17 heap data structure
 
B tree
B  treeB  tree
B tree
 
Linked list
Linked listLinked list
Linked list
 

Viewers also liked

Viewers also liked (20)

B-Tree
B-TreeB-Tree
B-Tree
 
B tree
B treeB tree
B tree
 
B Trees
B TreesB Trees
B Trees
 
BTree, Data Structures
BTree, Data StructuresBTree, Data Structures
BTree, Data Structures
 
Best for b trees
Best for b treesBest for b trees
Best for b trees
 
B trees and_b__trees
B trees and_b__treesB trees and_b__trees
B trees and_b__trees
 
b+ tree
b+ treeb+ tree
b+ tree
 
Algorithm Introduction #18 B-Tree
Algorithm Introduction #18 B-TreeAlgorithm Introduction #18 B-Tree
Algorithm Introduction #18 B-Tree
 
B trees and_b__trees
B trees and_b__treesB trees and_b__trees
B trees and_b__trees
 
B tree &amp;
B tree &amp;B tree &amp;
B tree &amp;
 
B tree long
B tree longB tree long
B tree long
 
12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS
 
stack and queue array implementation in java.
stack and queue array implementation in java.stack and queue array implementation in java.
stack and queue array implementation in java.
 
B tree short
B tree shortB tree short
B tree short
 
Algebra 1 2.8 Algebraic Proof
Algebra 1 2.8 Algebraic ProofAlgebra 1 2.8 Algebraic Proof
Algebra 1 2.8 Algebraic Proof
 
Insertion in RED BLACK TREE
Insertion in RED BLACK TREEInsertion in RED BLACK TREE
Insertion in RED BLACK TREE
 
Struktur data 06 (red black tree)
Struktur data 06 (red black tree)Struktur data 06 (red black tree)
Struktur data 06 (red black tree)
 
Logic gates with laws
Logic gates with lawsLogic gates with laws
Logic gates with laws
 
Red black trees presentation
Red black trees presentationRed black trees presentation
Red black trees presentation
 
10 Red-Black Trees
10 Red-Black Trees10 Red-Black Trees
10 Red-Black Trees
 

Similar to B tree

LEC 7-DS ALGO(expression and huffman).pdf
LEC 7-DS  ALGO(expression and huffman).pdfLEC 7-DS  ALGO(expression and huffman).pdf
LEC 7-DS ALGO(expression and huffman).pdfMuhammadUmerIhtisham
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search TreeAdityaK92
 
BTrees-fall2010.ppt
BTrees-fall2010.pptBTrees-fall2010.ppt
BTrees-fall2010.pptzalanmvb
 
B tree by-jash acharya
B tree by-jash acharyaB tree by-jash acharya
B tree by-jash acharyaJash Acharya
 
btrees.ppt ttttttttttttttttttttttttttttt
btrees.ppt  tttttttttttttttttttttttttttttbtrees.ppt  ttttttttttttttttttttttttttttt
btrees.ppt tttttttttttttttttttttttttttttRAtna29
 
Recursion tree method
Recursion tree methodRecursion tree method
Recursion tree methodRajendran
 
Optimal Binary Search tree ppt seminar.pptx
Optimal Binary Search tree ppt seminar.pptxOptimal Binary Search tree ppt seminar.pptx
Optimal Binary Search tree ppt seminar.pptxssusered44c8
 
Completing the square if a
Completing the square if aCompleting the square if a
Completing the square if aMartinGeraldine
 
Branch and bounding : Data structures
Branch and bounding : Data structuresBranch and bounding : Data structures
Branch and bounding : Data structuresKàŕtheek Jåvvàjí
 
Presentation on b trees [autosaved]
Presentation on b trees [autosaved]Presentation on b trees [autosaved]
Presentation on b trees [autosaved]AKASHKUMAR1542
 
NameInstructor1. Find the interval(s) where i.docx
NameInstructor1. Find the interval(s) where  i.docxNameInstructor1. Find the interval(s) where  i.docx
NameInstructor1. Find the interval(s) where i.docxrosemarybdodson23141
 
lecture10 date structure types of graph and terminology
lecture10 date structure types of graph and terminologylecture10 date structure types of graph and terminology
lecture10 date structure types of graph and terminologyKamranAli649587
 

Similar to B tree (20)

2-3 trees in c++
2-3 trees in c++2-3 trees in c++
2-3 trees in c++
 
4 1, 4 2
4 1, 4 24 1, 4 2
4 1, 4 2
 
08 B Trees
08 B Trees08 B Trees
08 B Trees
 
LEC 7-DS ALGO(expression and huffman).pdf
LEC 7-DS  ALGO(expression and huffman).pdfLEC 7-DS  ALGO(expression and huffman).pdf
LEC 7-DS ALGO(expression and huffman).pdf
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
BTrees-fall2010.ppt
BTrees-fall2010.pptBTrees-fall2010.ppt
BTrees-fall2010.ppt
 
2.pptx
2.pptx2.pptx
2.pptx
 
B tree by-jash acharya
B tree by-jash acharyaB tree by-jash acharya
B tree by-jash acharya
 
btrees.ppt ttttttttttttttttttttttttttttt
btrees.ppt  tttttttttttttttttttttttttttttbtrees.ppt  ttttttttttttttttttttttttttttt
btrees.ppt ttttttttttttttttttttttttttttt
 
Recursion tree method
Recursion tree methodRecursion tree method
Recursion tree method
 
B trees
B treesB trees
B trees
 
Optimal Binary Search tree ppt seminar.pptx
Optimal Binary Search tree ppt seminar.pptxOptimal Binary Search tree ppt seminar.pptx
Optimal Binary Search tree ppt seminar.pptx
 
Chapter 4.1 and 4.2
Chapter 4.1 and 4.2Chapter 4.1 and 4.2
Chapter 4.1 and 4.2
 
Completing the square if a
Completing the square if aCompleting the square if a
Completing the square if a
 
Branch and bounding : Data structures
Branch and bounding : Data structuresBranch and bounding : Data structures
Branch and bounding : Data structures
 
Presentation on b trees [autosaved]
Presentation on b trees [autosaved]Presentation on b trees [autosaved]
Presentation on b trees [autosaved]
 
NameInstructor1. Find the interval(s) where i.docx
NameInstructor1. Find the interval(s) where  i.docxNameInstructor1. Find the interval(s) where  i.docx
NameInstructor1. Find the interval(s) where i.docx
 
Binary Trees
Binary TreesBinary Trees
Binary Trees
 
Rumus matematik examonline spa
Rumus matematik examonline spaRumus matematik examonline spa
Rumus matematik examonline spa
 
lecture10 date structure types of graph and terminology
lecture10 date structure types of graph and terminologylecture10 date structure types of graph and terminology
lecture10 date structure types of graph and terminology
 

More from Rajendran

Element distinctness lower bounds
Element distinctness lower boundsElement distinctness lower bounds
Element distinctness lower boundsRajendran
 
Scheduling with Startup and Holding Costs
Scheduling with Startup and Holding CostsScheduling with Startup and Holding Costs
Scheduling with Startup and Holding CostsRajendran
 
Divide and conquer surfing lower bounds
Divide and conquer  surfing lower boundsDivide and conquer  surfing lower bounds
Divide and conquer surfing lower boundsRajendran
 
Medians and order statistics
Medians and order statisticsMedians and order statistics
Medians and order statisticsRajendran
 
Proof master theorem
Proof master theoremProof master theorem
Proof master theoremRajendran
 
Recurrence theorem
Recurrence theoremRecurrence theorem
Recurrence theoremRajendran
 
Master method
Master method Master method
Master method Rajendran
 
Master method theorem
Master method theoremMaster method theorem
Master method theoremRajendran
 
Master method theorem
Master method theoremMaster method theorem
Master method theoremRajendran
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithmsRajendran
 
Longest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm AnalysisLongest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm AnalysisRajendran
 
Dynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisDynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisRajendran
 
Average case Analysis of Quicksort
Average case Analysis of QuicksortAverage case Analysis of Quicksort
Average case Analysis of QuicksortRajendran
 
Np completeness
Np completenessNp completeness
Np completenessRajendran
 
computer languages
computer languagescomputer languages
computer languagesRajendran
 
proving non-computability
proving non-computabilityproving non-computability
proving non-computabilityRajendran
 
the halting_problem
the halting_problemthe halting_problem
the halting_problemRajendran
 

More from Rajendran (20)

Element distinctness lower bounds
Element distinctness lower boundsElement distinctness lower bounds
Element distinctness lower bounds
 
Scheduling with Startup and Holding Costs
Scheduling with Startup and Holding CostsScheduling with Startup and Holding Costs
Scheduling with Startup and Holding Costs
 
Divide and conquer surfing lower bounds
Divide and conquer  surfing lower boundsDivide and conquer  surfing lower bounds
Divide and conquer surfing lower bounds
 
Hash table
Hash tableHash table
Hash table
 
Medians and order statistics
Medians and order statisticsMedians and order statistics
Medians and order statistics
 
Proof master theorem
Proof master theoremProof master theorem
Proof master theorem
 
Recurrence theorem
Recurrence theoremRecurrence theorem
Recurrence theorem
 
Master method
Master method Master method
Master method
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
 
Hash tables
Hash tablesHash tables
Hash tables
 
Lower bound
Lower boundLower bound
Lower bound
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
Longest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm AnalysisLongest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm Analysis
 
Dynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisDynamic programming in Algorithm Analysis
Dynamic programming in Algorithm Analysis
 
Average case Analysis of Quicksort
Average case Analysis of QuicksortAverage case Analysis of Quicksort
Average case Analysis of Quicksort
 
Np completeness
Np completenessNp completeness
Np completeness
 
computer languages
computer languagescomputer languages
computer languages
 
proving non-computability
proving non-computabilityproving non-computability
proving non-computability
 
the halting_problem
the halting_problemthe halting_problem
the halting_problem
 

Recently uploaded

An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 

Recently uploaded (20)

An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 

B tree

  • 1.  Large degree B-trees used to represent very large dictionaries that reside on disk.  Smaller degree B-trees used for internal-memory dictionaries to overcome cache-miss penalties.
  • 2.  Definition assumes external nodes (extended m-way search tree).  B-tree of order m. ◦ m-way search tree. ◦ Not empty => root has at least 2 children. ◦ Remaining internal nodes (if any) have at least ceil(m/2) children. ◦ External (or failure) nodes on same level.
  • 3.  B-tree of order m. ◦ m-way search tree. ◦ Not empty => root has at least 2 children. ◦ Remaining internal nodes (if any) have at least ceil(m/2) children. ◦ External (or failure) nodes on same level. • 2-3 tree is B-tree of order 3. • 2-3-4 tree is B-tree of order 4.
  • 4.  B-tree of order m. ◦ m-way search tree. ◦ Not empty => root has at least 2 children. ◦ Remaining internal nodes (if any) have at least ceil(m/2) children. ◦ External (or failure) nodes on same level. • B-tree of order 5 is 3-4-5 tree (root may be 2-node though). • B-tree of order 2 is full binary tree.
  • 5.  n = # of pairs.  # of external nodes = n + 1.  Height = h => external nodes on level h + 1. 1 1 2 >= 2 3 >= 2*ceil(m/2) h + 1 >= 2*ceil(m/2)h-1 n + 1 >= 2*ceil(m/2)h-1 , h >= 1 level # of nodes
  • 6.  m = 200. n + 1 >= 2*ceil(m/2)h-1 , h >= 1 height # of pairs 2 >= 199 3 >= 19,999 4 >= 2 * 106 –1 5 >= 2 * 108 –1 h <= log ceil(m/2) [(n+1)/2] + 1
  • 7.  Worst-case search time. ◦ (time to fetch a node + time to search node) * height ◦ (a + b*m + c * log2m) * h where a, b and c are constants. m search time 50 400
  • 8. 15 20 8 4 1 3 5 6 30 409 Insertion into a full leaf triggers bottom-up node splitting pass. 16 17
  • 9.  ai is a pointer to a subtree.  pi is a dictionary pair. m a0 p1 a1 p2 a2 …pm am ceil(m/2)-1 a0 p1 a1 p2 a2 …pceil(m/2)-1 aceil(m/2)-1 m-ceil(m/2) aceil(m/2) pceil(m/2)+1 aceil(m/2)+1 …pm am • pceil(m/2) plus pointer to new node is inserted in parent.
  • 10. 15 20 8 4 1 3 5 6 30 409 • Insert a pair with key = 2. • New pair goes into a 3-node. 16 17
  • 11.  Insert new pair so that the 3 keys are in ascending order. • Split overflowed node around middle key. 1 2 3 • Insert middle key and pointer to new node into parent. 1 3 2
  • 12. 15 20 8 4 1 3 5 6 30 409 • Insert a pair with key = 2. 16 17
  • 13. 15 20 8 4 5 6 30 409 16 17 3 1 2 • Insert a pair with key = 2 plus a pointer into parent.
  • 14. • Now, insert a pair with key = 18. 15 20 8 1 2 4 5 6 30 409 16 173
  • 15.  Insert new pair so that the 3 keys are in ascending order. • Split the overflowed node. 16 17 18 • Insert middle key and pointer to new node into parent. 1816 17
  • 16. • Insert a pair with key = 18. 15 20 8 1 2 4 5 6 30 409 16 173
  • 17. • Insert a pair with key = 17 plus a pointer into parent. 15 20 8 1 2 4 5 6 30 4093 18 16 17
  • 18. • Insert a pair with key = 17 plus a pointer into parent. 8 1 2 4 5 6 30 4093 16 17 15 18 20
  • 19. • Now, insert a pair with key = 7. 1 2 4 5 6 30 4093 16 15 18 20 8 17
  • 20. • Insert a pair with key = 6 plus a pointer into parent. 30 401 2 4 93 16 15 18 20 8 17 5 7 6
  • 21. • Insert a pair with key = 4 plus a pointer into parent. 30 401 93 16 15 18 20 8 17 6 4 2 5 7
  • 22. • Insert a pair with key = 8 plus a pointer into parent. • There is no parent. So, create a new root. 30 40 1 9 3 16 15 18 20 6 8 2 5 7 4 17
  • 23. • Height increases by 1. 30 401 93 16 15 18 2062 5 7 4 17 8

Editor's Notes

  1. May also be used internally to reduce cache misses and hence improve performance.
  2. Alternative definition has pairs only in leaves; remaining nodes have keys only. Leaf-pushed B-tree or B+-tree.
  3. Not possible for an internal node in an extended tree to have only 1 child.
  4. Typically pick m so as to fill a block.
  5. 2-3 Tree. Insert 10, no problem. Insert 18?
  6. Node Splitting
  7. The code will do all 3 steps as one.