1
1
# B-Trees
2
2
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
+
3
16
## Background
4
17
Is the fastest way to search for data to store them in an array, sort them and perform binary search? No. This will
5
18
incur 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>
15
28
B-tree is another of self-balancing search tree data structure that maintains sorted data and allows for efficient
16
29
insertion, deletion and search operations.
17
30
18
- ### (a,b) trees
31
+ ## (a,b) trees
19
32
20
33
Before we talk about B-trees, we first introduce its family (generalized form) - (a,b) trees. <br >
21
34
@@ -29,7 +42,7 @@ Here is a (2,4) tree to aid visualisation as we go through the (a,b) tree rules/
29
42
![ (2,4) tree] ( ../../../../../docs/assets/images/(2,4)tree.jpg )
30
43
31
44
32
- ### Implementation Invariant /(a,b) Tree Rules
45
+ ### Implementation Invariants /(a,b) Tree Rules
33
46
Rule #1 : (a,b)-child Policy
34
47
The min and max of keys and children each node can have are bounded as follows:
35
48
![ (a,b) child policy] ( ../../../../../docs/assets/images/(a,b)childpolicy.jpg )
@@ -63,7 +76,7 @@ Rule #3: Leaf depth
63
76
All leaf nodes must be at the same depth from root.
64
77
- This property forces the tree to be balanced.
65
78
66
- ## Complexity Analysis
79
+ ### Complexity Analysis
67
80
68
81
** Search, Insertion, Deletion Time** : O(bloga(n)) = O(logn)
69
82
0 commit comments