view src/bst.h @ 10:68f85ffc6029

Finished rbtree. Reworked the iterators in list. Minor tweaks to others.
author Eris Caffee <discordia@eldalin.com>
date Fri, 28 Sep 2012 18:24:53 -0500
parents abdba37f67a2
children d359966ed8de
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);
14 void * bst_insert (struct bst * bst, void * data);
15 void * bst_search (struct bst * bst, void * data);
16 void * bst_search_iterative (struct bst * bst, void * data);
17 void * bst_minimum (struct bst * bst);
18 void * bst_maximum (struct bst * bst);
20 void bst_walk_inorder (struct bst * bst, void (*op)(void * data));
21 void bst_walk_preorder (struct bst * bst, void (*op)(void * data));
22 void bst_walk_postorder (struct bst * bst, void (*op)(void * data));
24 struct bst_iterator * bst_begin (struct bst * bst);
25 struct bst_iterator * bst_end (struct bst * bst);
26 struct bst_iterator * bst_next (struct bst_iterator * it);
27 struct bst_iterator * bst_prev (struct bst_iterator * it);
28 void * bst_value (struct bst_iterator * it);
29 void * bst_find (struct bst_iterator * it, void * data);
30 void * bst_remove (struct bst_iterator * it);
32 void bst_dump (struct bst * bst, void (*print_val)(void *) );
34 #endif