-
Notifications
You must be signed in to change notification settings - Fork 0
/
btree.h
38 lines (25 loc) · 661 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
#ifndef BTREE_H_
#define BTREE_H_
#include<stdio.h>
#include<stdlib.h>
#include"queue.h"
#include"vector.h"
/*
A BTree's got at least (degree - 1) keys and at most (2 * degree - 1) keys
*/
struct BTree
{
int degree;
struct vector *keys;
struct vector *children;
};
struct BTree* bt_init(int degree, struct vector *keys);
struct BTree* bt_create(int degree, struct vector *keys);
int bt_is_empty(struct BTree *T);
void bt_breadth_first_print(struct BTree *T);
int bt_size(struct BTree *T);
int bt_height(struct BTree *T);
int bt_width(struct BTree *T);
void bt_insert_downwards(struct BTree *T, int x);
void bt_delete(struct BTree *T);
#endif