// binarySearchTree.h -- 2011-07-27-17.14
class binarySearchTree
{
public:
enum direction {Direction_Left, Direction_Right} ;
typedef int Item ;
typedef struct node
{
Item item ;
struct node * left, * right ;
} Node ;
private:
Node * m_root ;
int m_current ;
Node * m_makeNode (const Item item) ;
void m_print (const Node & node) ;
Node * m_leftmostOrRightmostNode (Node * const pNode, const direction directionComeFrom) ;
void m_removeAll (Node * pNode) ;
public:
binarySearchTree (void) ;
bool isEmpty (void) ;
bool insert (const Item item) ;
bool remove (const Item item) ;
void print (void) ;
// If you called becomeToATwoWayCirculationLinkedListAndPrintItAndEmptyTheTree()
// will change the tree to a two way circulation linked list and print all the elements in diminsihing order and increment order,
// and empty the tree at last.
void becomeToATwoWayCirculationLinkedListAndPrintItAndEmptyTheTree (const direction headDirection) ;
~binarySearchTree (void) ;
} ;