| iMatix home page | << | < | > | >> |
SFL Version 2.11 |
Filename: sfltree.h
Package: Standard Function Library (SFL)
Written: 1997/11/18 Jonathan Schultz jonathan@imatix.com
Revised: 1998/01/03 Jonathan Schultz jonathan@imatix.com
Copyright: Copyright (c) 1996-2000 iMatix Corporation
Provides functions to maintain 'Red-Black' balanced binary trees. You can use these functions to work with trees of any structure. To make this work, all structures must start with the following: "void *left, *right, *parent; TREE_COLOUR colour;". All trees need a pointer to the root of type TREE which should be initialised with tree_init - you can test whether a tree is empty by comparing its root with TREE_NULL. The order of nodes in the tree is determined by calling a node comparison function provided by the caller - this accepts two node pointers and returns zero if the two nodes are equal, -1 if the first is smaller and 1 if the first is larger.
sfltree.h defines these symbols, possibly conditionally:
Symbol: | Defined as: |
---|---|
SFLTREE_INCLUDED | TRUE |
TREE_DUPLICATE | -1 |
TREE_NULL | &TREE_EMPTY |
TREE_OK | 0 |
Type name: | Defined as: |
---|---|
TREE_COLOUR | enum {BLACK, RED} |
TREE_COMPARE | int () (void *t1, void *t2) |
TREE_PROCESS | void () (void *t) |
| << | < | > | >> | Copyright © 1996-2000 iMatix Corporation |