view src/bst.h @ 9:abdba37f67a2

Red-black tree in progress. Linked list needs iterators redone, also in progress. Sleepy.
author Eris Caffee <discordia@eldalin.com>
date Fri, 28 Sep 2012 03:08:25 -0500
parents 6605a342e8f8
children 68f85ffc6029
line source
1 #ifndef BST_H_
2 #define BST_H_
4 #include <stddef.h>
5 #include <stdbool.h>
7 struct bst_node;
8 struct bst;
9 struct bst_iterator;
11 struct bst * bst_new(bool (*le)(void * a, void * b), bool (*eq)(void * a, void * b));
12 void bst_delete(struct bst * bst);
13 void * bst_insert(struct bst * bst, void * data);
14 void * bst_search(struct bst * bst, void * data);
15 void * bst_search_iterative(struct bst * bst, void * data);
16 void * bst_minimum(struct bst * bst);
17 void * bst_maximum(struct bst * bst);
18 void bst_walk_inorder(struct bst * bst, void (*op)(void * data));
19 void bst_walk_preorder(struct bst * bst, void (*op)(void * data));
20 void bst_walk_postorder(struct bst * bst, void (*op)(void * data));
21 struct bst_iterator * bst_begin(struct bst * bst);
22 struct bst_iterator * bst_end(struct bst * bst);
23 struct bst_iterator * bst_next(struct bst_iterator * it);
24 struct bst_iterator * bst_prev(struct bst_iterator * it);
25 void * bst_value(struct bst_iterator * it);
26 void * bst_find(struct bst_iterator * it, void * data);
27 void * bst_remove(struct bst_iterator * it);
29 #endif