11# B-Trees
22
3+ ### Table of Contents
4+ - [ Background] ( #background )
5+ - [ (a,b) trees] ( #-ab--trees )
6+ - [ Implementation Invariants/(a,b) Tree Rules] ( #implementation-invariants--ab--tree-rules )
7+ - [ Complexity Analysis] ( #complexity-analysis )
8+ - [ How do B Trees relate to (a,b) trees?] ( #how-do-b-trees-relate-to--ab--trees )
9+ - [ Search Operation] ( #search-operation )
10+ - [ Insert Operation] ( #insert-operation )
11+ - [ Split Child Method] ( #split-child-method )
12+ - [ Delete Operation] ( #delete-operation )
13+ - [ Application] ( #application )
14+
15+
316## Background
417Is the fastest way to search for data to store them in an array, sort them and perform binary search? No. This will
518incur minimally O(nlogn) sorting cost, and O(n) cost per insertion to maintain sorted order. <br >
@@ -15,7 +28,7 @@ deletion and search operations to O(h) ~= O(logn). <br>
1528B-tree is another of self-balancing search tree data structure that maintains sorted data and allows for efficient
1629insertion, deletion and search operations.
1730
18- ### (a,b) trees
31+ ## (a,b) trees
1932
2033Before we talk about B-trees, we first introduce its family (generalized form) - (a,b) trees. <br >
2134
@@ -29,7 +42,7 @@ Here is a (2,4) tree to aid visualisation as we go through the (a,b) tree rules/
2942![ (2,4) tree] ( ../../../../../docs/assets/images/(2,4)tree.jpg )
3043
3144
32- ### Implementation Invariant /(a,b) Tree Rules
45+ ### Implementation Invariants /(a,b) Tree Rules
3346Rule #1 : (a,b)-child Policy
3447The min and max of keys and children each node can have are bounded as follows:
3548![ (a,b) child policy] ( ../../../../../docs/assets/images/(a,b)childpolicy.jpg )
@@ -63,7 +76,7 @@ Rule #3: Leaf depth
6376All leaf nodes must be at the same depth from root.
6477- This property forces the tree to be balanced.
6578
66- ## Complexity Analysis
79+ ### Complexity Analysis
6780
6881** Search, Insertion, Deletion Time** : O(bloga(n)) = O(logn)
6982
0 commit comments