git-svn-id: http://moon:8086/svn/software/trunk/libsrc/bintree@1 b431acfa-c32f-4a4a-93f1-934dc6c82436
43 lines
1.3 KiB
C
Executable File
43 lines
1.3 KiB
C
Executable File
// ------------------------------------------------------------
|
|
// bintree.h
|
|
// Implementation of a binary tree
|
|
//
|
|
// 27.02.2005, J.Ahrensfeld
|
|
// ------------------------------------------------------------
|
|
#ifndef BINTREE_H
|
|
#define BINTREE_H
|
|
|
|
// ------------------------------------------------------------
|
|
typedef struct _node_t
|
|
{
|
|
double value;
|
|
void *pData;
|
|
|
|
struct _node_t *pParent;
|
|
struct _node_t *pLeft;
|
|
struct _node_t *pRight;
|
|
|
|
} node_t;
|
|
|
|
// ------------------------------------------------------------
|
|
node_t* node_init(node_t *pObj, double value, void *pData, int size);
|
|
node_t* node_insert(node_t *pObj, double value, void *pData, int size);
|
|
node_t* node_lookup(node_t *pObj, double value);
|
|
node_t* node_remove(node_t *pObj);
|
|
void bintree_print(node_t *pObj);
|
|
int bintree_size(node_t *pObj);
|
|
int bintree_maxdepth(node_t *pObj);
|
|
double bintree_minvalue(node_t *pObj);
|
|
double bintree_maxvalue(node_t *pObj);
|
|
node_t *bintree_GetLeafMax(node_t *pObj);
|
|
node_t *bintree_GetLeafMin(node_t *pObj);
|
|
int bintree_isBST(node_t *pObj);
|
|
int bintree_isBSTUtil(node_t *pObj, double min, double max);
|
|
node_t *bintree_GetNodeMax(node_t *pObj);
|
|
node_t *bintree_GetNodeMin(node_t *pObj);
|
|
int bintree_destroy(node_t *pObj);
|
|
|
|
|
|
// ------------------------------------------------------------
|
|
#endif // BINTREE_H
|