Subversion Repositories PlanixRsrch.SVN

Compare Revisions

Ignore whitespace Rev 72 → Rev 73

/trunk/libmavl/mavl.h
30,9 → 30,7
 
#include <stdlib.h>
 
 
 
/** Maximum AVL Tree depth.
/** Maximum AVL tree depth.
The number of nodes is calculated by 2^depth.
So a value of 32 should be enough for around 4
billion nodes. This value is only used within
39,7 → 37,7
struct mavliter.
*/
#ifndef MAVL_MAX_DEPTH
#define MAVL_MAX_DEPTH 64
#define MAVL_MAX_DEPTH 32
#endif
 
/**
46,8 → 44,11
* Defines the structure of an AVL Node.
*/
struct mavlnode {
struct mavlnode * s[2]; /* Pointer to left and right son */
int bal:3; /* AVL balance factor */
struct mavlnode * s[2]; /* Pointer to left and right son.
s[0] is the "left" son
s[1] is the right son
*/
int bal:3; /* AVL balance factor - 3 bits*/
};
 
/**
54,17 → 55,17
* Definition of an AVL Tree
*/
struct mavl {
struct mavlnode *root; /* Pointer to root node */
struct mavlnode *root; /* Pointer to root node */
int (*cmp) (const void *, const void *); /* Compare function */
void (*del) (void *); /* Delete element function */
int count; /* Number of elements currently stored
* in the tree */
void *(*malloc) (size_t n); /* used to allocate a new mavlnode */
void (*free) (void *ptr); /* used to free a mavlnode */
void (*del) (void *); /* Delete element function */
int count; /* Number of elements currently stored
* in the tree */
void *(*malloc) (size_t n); /* used to allocate a new mavlnode */
void (*free) (void *ptr); /* used to free a mavlnode */
 
/*
* size of data appended to each mavlnode element. used to allocate
* space in mavl_add.
* size of data appended to each mavlnode element.
* Used to allocate space in mavl_add.
*/
size_t data_size;
};
81,7 → 82,8
void mavl_del_all(struct mavl *t);
int mavl_get_depth(struct mavl *t);
int mavl_verify(struct mavl *t);
void mavl_print(struct mavl *t, void (*pcb)(char*,struct mavlnode *), int width);
void mavl_print(struct mavl *t,
void (*pcb)(char*,struct mavlnode *), int width);
 
 
 
/trunk/libmavl
Property changes:
Modified: svn:mergeinfo
## -0,0 +0,1 ##
Merged /branches/ai/libmavl:r67-72