Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

Binary tree abstraction (AVL tree)


Data Structures

struct  s_cf_dataset
struct  s_cf_tree
struct  s_cf_tree_node

Typedefs

typedef s_cf_dataset t_cf_tree_dataset
typedef s_cf_tree_node t_cf_tree_node
typedef s_cf_tree t_cf_tree

Enumerations

enum  e_cf_tree_balance { CF_TREE_NONE, CF_TREE_LEFT, CF_TREE_RIGHT }

Functions

void cf_tree_init (t_cf_tree *tree, int(*compare)(t_cf_tree_dataset *, t_cf_tree_dataset *), void(*destroy)(t_cf_tree_dataset *))
void cf_tree_destroy (t_cf_tree *tree)
int cf_tree_insert (t_cf_tree *tree, t_cf_tree_node **n, t_cf_tree_dataset *d)
int cf_tree_remove (t_cf_tree *tree, t_cf_tree_node **n, t_cf_tree_dataset *key)
const t_cf_tree_datasetcf_tree_find (t_cf_tree *tree, t_cf_tree_node *n, t_cf_tree_dataset *key)

Typedef Documentation

typedef struct s_cf_tree t_cf_tree
 

AVL tree structure

typedef struct s_cf_dataset t_cf_tree_dataset
 

dataset structure. Used to store data in a tree node

typedef struct s_cf_tree_node t_cf_tree_node
 

AVL tree node structure


Enumeration Type Documentation

enum e_cf_tree_balance
 

balancing types. NONE means balanced, LEFT means left subtree is overbalanced and right means right subtree is overbalanced.

Enumeration values:
CF_TREE_NONE  balanced
CF_TREE_LEFT  Left overbalanced
CF_TREE_RIGHT  Right overbalanced

Definition at line 405 of file utils.h.


Function Documentation

void cf_tree_destroy t_cf_tree tree  ) 
 

This function is used to destroy a tree

Parameters:
tree The tree object

Definition at line 1104 of file utils.c.

const t_cf_tree_dataset* cf_tree_find t_cf_tree tree,
t_cf_tree_node n,
t_cf_tree_dataset key
 

Looks up a dataset

Parameters:
tree The tree object structure
n Always set to NULL
key A dataset structure with a valid key
Returns:
NULL if element could not be found, element reference if element has been found

Definition at line 1061 of file utils.c.

void cf_tree_init t_cf_tree tree,
int(*  compare)(t_cf_tree_dataset *, t_cf_tree_dataset *),
void(*  destroy)(t_cf_tree_dataset *)
 

This function initializes a new tree object

Parameters:
tree The tree object structure
compare The comparing function
destroy The destructor function for tree elements

Definition at line 1075 of file utils.c.

int cf_tree_insert t_cf_tree tree,
t_cf_tree_node **  n,
t_cf_tree_dataset d
 

This function inserts a tree node into a tree with the data of dataset d (d will be copied)

Parameters:
tree The tree object structure
n Set always to NULL
d The dataset structure. Will be copied
Returns:
CF_TREE_NONE, CF_TREE_LEFT or CF_TREE_RIGHT

Definition at line 804 of file utils.c.

int cf_tree_remove t_cf_tree tree,
t_cf_tree_node **  n,
t_cf_tree_dataset key
 

Removes a node from a tree (expensive!)

Parameters:
tree The tree object structure
n Set always to NULL
key A dataset structure with a valid key set
Returns:
CF_TREE_NONE, CF_TREE_LEFT or CF_TREE_RIGHT

Definition at line 1015 of file utils.c.


Generated on Sun Apr 25 16:37:40 2004 for Classic Forum by doxygen 1.3.5