49 lines
No EOL
978 B
C++
49 lines
No EOL
978 B
C++
#ifndef _bintree_hpp_
|
|
#define _bintree_hpp_
|
|
#include "binnode.hpp"
|
|
#include "list.hpp"
|
|
#include "queue.hpp"
|
|
template <class T>
|
|
class binTree
|
|
{
|
|
protected:
|
|
binNodeArray(T) _root;
|
|
|
|
public:
|
|
binNodeArray(T) root()
|
|
{
|
|
return _root;
|
|
}
|
|
binTree()
|
|
{
|
|
_root = new binNode<T>;
|
|
}
|
|
|
|
binNodeArray(T) addLC(binNodeArray(T) node,T data)
|
|
{ if(node->lc)
|
|
return NULL;
|
|
|
|
binNodeArray(T) temp = new binNode<T>;
|
|
temp->data = data;
|
|
node->lc = temp;
|
|
return temp;
|
|
}
|
|
|
|
binNodeArray(T) addRC(binNodeArray(T) node,T data)
|
|
{ if(node->rc)
|
|
return NULL;
|
|
|
|
binNodeArray(T) temp = new binNode<T>;
|
|
temp->data = data;
|
|
node->rc = temp;
|
|
return temp;
|
|
}
|
|
void trav_level()
|
|
{
|
|
|
|
}
|
|
};
|
|
|
|
#endif
|
|
|
|
#include "bintree.h" |