-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharvoreBMais.h
54 lines (49 loc) · 1.57 KB
/
arvoreBMais.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
53
54
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "func.h"
// Default order
#define ORDER 3
typedef struct record
{
int value;
Funcionario reg;
} record;
// Node
typedef struct No
{
void **pointers;
int *keys;
struct No *parent;
bool is_leaf;
int num_keys;
struct No *next;
} No;
int order = ORDER;
No *queue = NULL;
bool verbose_output = false;
void enqueue(No *new_node);
No *dequeue(void);
void printLeaves(No *const root);
int height(No *const root);
int pathToLeaves(No *const root, No *child);
void printTree(No *const root);
void findAndPrint(No *const root, int key, bool verbose);
void findAndPrintRange(No *const root, int key_start, int key_end, bool verbose);
int findRange(No *const root, int key_start, int key_end, bool verbose, int returned_keys[], void *returned_pointers[]);
No *findLeaf(No *const root, int key, bool verbose);
record *find(No *root, int key, bool verbose, No **leaf_out);
int cut(int length);
record *makeRecord(int value);
No *makeNode(void);
No *makeLeaf(void);
int getLeftIndex(No *parent, No *left);
No *insertIntoLeaf(No *leaf, int key, record *pointer);
No *insertIntoLeafAfterSplitting(No *root, No *leaf, int key, record *pointer);
No *insertIntoNode(No *root, No *n, int left_index, int key, No *right);
No *insertIntoNodeAfterSplitting(No *root, No *old_node, int left_index, int key, No *right);
No *insertIntoParent(No *root, No *left, int key, No *right);
No *insertIntoNewRoot(No *left, int key, No *right);
No *startNewTree(int key, record *pointer);
No *insert(No *root, int key, int value);