Pristine Ack-5.5
[Ack-5.5.git] / util / grind / avl.h
1 /* $Id: avl.h,v 1.2 1994/06/24 10:59:11 ceriel Exp $ */
2
3 /* AVL-trees: trees in which the difference in depth
4    of the left branch and the right branch is at most one.
5    Information in the nodes is represented by a pointer, which is to
6    be supplied by the user. The user is also expected to supply a
7    comparison routine for each AVL tree. This routine is offered two
8    parameters, both pointers, and is expected to return:
9    a negative number    if the comparison result is <
10    0                    if the comparison result is =
11    a positive number    if the comparison result is >
12 */
13
14 typedef struct avl_tree *AVL_tree;
15
16 /* extern AVL_tree create_avl_tree(int (*cmp)());
17    Returns a fresh avl_tree structure. 'cmp' will be used as comparison
18    routine for this tree.
19 */
20 extern AVL_tree create_avl_tree();
21
22 /* extern add_to_avl_tree(AVL_tree tree, char *n);
23    Adds the information indicated by 'n' to the avl_tree indicated by 'tree'.
24 */
25 extern add_to_avl_tree();
26
27 /* extern char *find_ngt(AVL_tree tree, char *n);
28    Returns the information in the largest node that still compares <= to 'n',
29    or 0 if not present.
30 */
31 extern char *find_ngt();
32
33 /* extern char *find_nlt(AVL_tree tree, char *n);
34    Returns the information in the largest node that still compares >= to 'n',
35    or 0 if not present.
36 */
37 extern char *find_nlt();
38
39 /* extern char *find_eq(AVL_tree tree, char *n);
40    Returns the information in the node that compares equal to 'n',
41    or 0 if not present.
42 */
43 extern char *find_eq();