-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbPlusTree.hpp
45 lines (38 loc) · 1.08 KB
/
bPlusTree.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<list>
#include<vector>
#include<map>
#include<utility>
#include"treeNode.hpp"
// <PROJECT>_<PATH>_<FILE>_H_.
#ifndef BPLUSTREE_H_
#define BPLUSTREE_H_
class bPlusTree {
private:
int degree;
int minPairsSize;
treeNode *root;
std::vector<treeNode*> tracePath;
std::list<treeNode*> leafList;
public:
bPlusTree();
bPlusTree(int m);
void init(int m);
int search(int key);
int searchRange(int start, int finish);
treeNode* searchLeaf(int key);
int insertion(int key, double value);
int deletion(int key);
bool borrowFromLeaf(treeNode* parent, treeNode *deficient);
bool borrowFromIndex(treeNode* parent, treeNode *deficient);
bool combineWithLeaf(treeNode* parent, treeNode *deficient);
bool combineWithIndex(treeNode* parent, treeNode *deficient);
int getInvalidParentKeyIdx(treeNode* parent, std::vector<treeNode*>::iterator changNodeIt);
/**
* test functions
*/
int getTreeDegree();
void printLeafList();
void printTree(treeNode* root);
treeNode* getRoot();
};
#endif // BPLUSTREE_H_