Initial MSVC 2008 projects workspace
This commit is contained in:
47
l2ooghelper/BinTree.h
Normal file
47
l2ooghelper/BinTree.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef BINTREE_H_
|
||||
#define BINTREE_H_
|
||||
|
||||
class BinTreeNode
|
||||
{
|
||||
public:
|
||||
BinTreeNode();
|
||||
BinTreeNode( unsigned int keyInit );
|
||||
virtual ~BinTreeNode();
|
||||
public:
|
||||
BinTreeNode *parent;
|
||||
BinTreeNode *left;
|
||||
BinTreeNode *right;
|
||||
unsigned int key;
|
||||
};
|
||||
|
||||
class BinTree
|
||||
{
|
||||
public:
|
||||
BinTree() { root = NULL; }
|
||||
virtual ~BinTree();
|
||||
public:
|
||||
bool addNode( BinTreeNode *node );
|
||||
BinTreeNode *findNode( unsigned int key );
|
||||
bool delNode( BinTreeNode *node );
|
||||
bool delNode( unsigned int key );
|
||||
|
||||
void deleteAll();
|
||||
|
||||
BinTreeNode *getRoot() const { return this->root; }
|
||||
|
||||
#ifdef _DEBUG
|
||||
public:
|
||||
bool addNodeDebug( BinTreeNode *node, FILE *f );
|
||||
BinTreeNode *findNodeDebug( unsigned int key, FILE *f );
|
||||
bool delNodeDebug( unsigned int key, FILE *f );
|
||||
bool delNodeDebug( BinTreeNode *node, FILE *f );
|
||||
void printTree( FILE *f );
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void del_recursive( BinTreeNode *node );
|
||||
protected:
|
||||
BinTreeNode *root;
|
||||
};
|
||||
|
||||
#endif /* BINTREE_H_ */
|
Reference in New Issue
Block a user