btree.h (454B)
1 /** 2 * btree -- a balk tree implementation ;-) 3 * Copyright 2020, 2021 Matthias Balk 4 */ 5 6 #ifndef BTREE_H 7 #define BTREE_H 8 9 #include <stdlib.h> 10 11 typedef struct node 12 { 13 char *data; 14 void *lchild; 15 void *rchild; 16 } node_t; 17 18 19 node_t* bt_new(); 20 void bt_free(node_t *tree, u_int8_t free_data); 21 22 u_int8_t bt_add(node_t *tree, char *data); 23 u_int8_t bt_contains(node_t *tree, const char *data); 24 25 void bt_print_sorted(const node_t *tree); 26 27 #endif /* BTREE_H */