-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBTree.hpp
57 lines (44 loc) · 1.33 KB
/
BTree.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
46
47
48
49
50
51
52
53
54
55
56
57
//
// BTree.hpp
// Projekt_AISD4 (B-Tree)
//
// Created by Michał Boczoń on 20/05/2021.
//
#pragma once
#include <stdio.h>
#include "Node.hpp"
#include <vector>
#include <string>
#include <cmath>
class BTree
{
private:
int t;
Node* root;
public:
BTree(int t);
Node* getRoot();
std::pair<Node*, int> search(Node* father, int k);
int findKeyInNode(Node* N, int k);
int findPredecessor(Node* father, int index);
int findSuccessor(Node* father, int index);
void splitChild(Node* father, int i, Node* y);
void insert(int k);
void insertNonFull(Node* father, int k);
void remove(Node* father, int k);
void deleteFromLeaf(Node* leaf, int index);
void deleteFromNonLeaf(Node* father, int index);
void merge(Node* father, int index);
void fill(Node* father, int index);
void borrowFromPrev(Node* father, int index);
void borrowFromNext(Node* father, int index);
void load(Node*father, std::string s, int& index);
void save();
int convertToInteger(std::string s, int& i);
int calculateAccesses(int k);
int nextOccurance(std::vector<int> queries, int k, int index);
void printValuesInIncreasingOrder(Node* father);
void printTree(Node* father);
void printCacheImpact(int capacity, std::string s);
~BTree();
};