-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBTree.h
52 lines (42 loc) · 918 Bytes
/
BTree.h
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
46
47
48
49
50
51
52
#ifndef __BTREE_H_
#define __BTREE_H_
#include "BTreeNode.h"
class BTree {
private:
int M; //ordem da b-árvore
int numberOfKeys; // quantidade de chaves
int numberOfNodes; // quantidade de nós
BTreeNode* root;
BTreeNode* search(int, BTreeNode*);
void add(BTreeNode*, int);
int remove(BTreeNode*, int);
void print(BTreeNode*, int);
BTreeNode* findBrother(BTreeNode* , int *, bool *);
BTreeNode* sucessor (BTreeNode *);
void fusion (BTreeNode* , BTreeNode* , BTreeNode*);
void splitChild(BTreeNode*,int);
public:
BTree(int order) {
M = order;
numberOfNodes = 0;
numberOfKeys = 0;
root = 0;
}
~BTree() {
delete root;
}
bool search(int value) {
return search(value, root) != 0;
}
void add(int);
bool remove(int);
void print() {
print(root, 0);
}
int getNumberOfNodes ()
{
return numberOfNodes;
}
//int min(int);
};
#endif