/avl

libavl is a small implementation of AVL trees for the C programming language. It is distributed under the Library GNU Public License (see the file LICENSE for details).

Primary LanguageCGNU General Public License v3.0GPL-3.0

========================================================================

WHAT IS LIBAVL?

libavl is a small implementation of AVL trees for the C programming
language.  It is distributed under the Library GNU Public License (see
the file LICENSE for details).

This library does the basic stuff. It allows for inserts, searches, and
deletes in O(log n) time. It also allows the tree to be used as a linked
indexable list (search functions cannot be used in that case).

If you find a bug, you should mail Wessel Dankers <wsl@nl.linux.org>,
who produced this version of the library and therefore is to blame.

The original author is Michael H. Buselli <cosine@cosine.org>, who can
be reached at the following address:

	Michael H. Buselli
	4334 N. Hazel St. #515
	Chicago, IL  60613-1456

========================================================================

COMPILING THE LIBRARY

./configure --prefix=<where you want it to end up>
make
make install

========================================================================

USING THE LIBRARIES

There are manpages for the functions in libavl. Look at avl.h (you need to
include these headers in your programs to use the library) to see what
functions and structures are available. As a small example:

	#define BUFSIZE 8192

	int main(void) {
		char *buf[BUFSIZE];
		avl_tree_t *tree;
		avl_node_t *node;

		tree = avl_tree_malloc((avl_cmp_t)strcmp, (avl_free_t)free);

		while(fgets(buf, BUFSIZE, stdin))
			avl_item_insert(tree, strdup(buf));

		for(node = tree->head; node; node = node->next)
			printf("%s", node->item);

		avl_tree_free(tree);
	}

A real implementation would check the return values of avl_tree_malloc,
avl_insert and strdup, of course.

========================================================================