Skip to content

Commit 5cb38b4

Browse files
committed
docs: added table of contents to btree readme
1 parent 7de4e15 commit 5cb38b4

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Gradle is used for development.
8282
* AVL-tree
8383
* Orthogonal Range Searching
8484
* [Trie](src/main/java/dataStructures/trie)
85-
* B-Tree
85+
* [B-Tree](src/main/java/dataStructures/bTree)
8686
* Red-Black Tree (Not covered in CS2040s but useful!)
8787
* Kd-tree (**WIP**)
8888
* Interval tree (**WIP**)

src/main/java/dataStructures/bTree/README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
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
417
Is the fastest way to search for data to store them in an array, sort them and perform binary search? No. This will
518
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>
1528
B-tree is another of self-balancing search tree data structure that maintains sorted data and allows for efficient
1629
insertion, deletion and search operations.
1730

18-
### (a,b) trees
31+
## (a,b) trees
1932

2033
Before 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
3346
Rule #1: (a,b)-child Policy
3447
The 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
6376
All 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

Comments
 (0)