47 lines
738 B
C++
47 lines
738 B
C++
|
#ifndef _binnode_hpp_
|
||
|
#define _binnode_hpp_
|
||
|
#include <iostream>
|
||
|
#include <string>
|
||
|
#define binNodeArray(T) binNode<T> *
|
||
|
|
||
|
template <class T>
|
||
|
class binNode
|
||
|
{
|
||
|
public:
|
||
|
T data;
|
||
|
std::string pos;
|
||
|
binNode *parent;
|
||
|
binNode *lc;
|
||
|
binNode *rc;
|
||
|
binNode()
|
||
|
{
|
||
|
parent = NULL;
|
||
|
lc = NULL;
|
||
|
rc = NULL;
|
||
|
}
|
||
|
binNode(binNode *p, binNode *l, binNode *r)
|
||
|
{
|
||
|
parent = p;
|
||
|
lc = l;
|
||
|
rc = r;
|
||
|
}
|
||
|
~binNode()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
bool operator>(binNode const &bn)
|
||
|
{
|
||
|
return data > bn.data;
|
||
|
}
|
||
|
|
||
|
bool operator<(binNode const &bn)
|
||
|
{
|
||
|
return data < bn.data;
|
||
|
}
|
||
|
|
||
|
bool operator==(binNode const &bn)
|
||
|
{
|
||
|
return data == bn.data;
|
||
|
}
|
||
|
};
|
||
|
#endif
|