-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbTree.h
62 lines (40 loc) · 1.7 KB
/
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
53
54
55
56
57
58
59
60
61
62
/*
* File: FilaEnc.h
* Author: Fábio Tramasoli (0619132)
* About: bTree agnóstica a tipos.
*
*/
#define BTREE_VAZIA -1
#define BTREE_CHEIA 10
#define BTREE_OPERACAO_OK 0
#define BTREE_OPERACAO_ERR 1
typedef struct{
void *content;
void *left;
void *right;
void *father;
}tBTreeNode;
typedef struct{
tBTreeNode *root;
int bytes;
int negative;
}tBTree;
int inicializaBTree(tBTree *f, int bytes, int negative);
int finalizaBTree(tBTree *f);
int vaziaBTree(tBTree *f);
int cheiaBTree(tBTree *f);
int inserirBTree(tBTree *f, void *valor);
int removerBTree(tBTree *f, tBTreeNode *toRemove);
int removerBTreeSemValor(tBTree *f);
int infoBTree(tBTreeNode* p, void *content, int bytes); //retorna o conteúdo do nó
int findBtree(tBTree *f, void *valor, tBTreeNode** node); //retorna o ponteiro que contem o conteúdo
int leftBTree(tBTreeNode* p, tBTreeNode* node); //retorna ponteiro para o nó filho da esq.
int rightBTree(tBTreeNode* p, tBTreeNode* node); //retorna ponteiro para nó filho da direita
int fatherBTree(tBTreeNode* p, tBTreeNode* node); //retorna ponteiro para o pai
int brotherBTree(tBTreeNode* p, tBTreeNode* node); //retorna ponteiro para o nó irmão
int biggerBTree(tBTreeNode* p, tBTreeNode** node); //retorna ponteiro para maior na subarvore
int isLeftBTree(tBTreeNode* p); //retorna true se p é um filho esquerdo
int isRightBTree(tBTreeNode* p); //retorna true se p é um filho direito
int setLeftBTree(tBTreeNode* p, void *content, int bytes); //define x um filho esq para p, com conteúdo x;
int setRightBTree(tBTreeNode* p, void *content, int bytes); //define x um filho dir para p, com conteúdo x;
int sortedIntWalkBTree(tBTreeNode* p, int level, char* format);