5 #ifndef VMML_BinarySearchTreeNode_h
6 #define VMML_BinarySearchTreeNode_h
31 this->
left->setParent(
this);
34 return this->
left->insert(data);
40 this->
right->setParent(
this);
43 return this->
right->insert(data);
53 std::cout <<
"data not in tree" << std::endl;
60 if(this->
left->remove(data))
68 if(nodeToDelete->
getLeft() == 0L)
71 }
else if ( nodeToDelete->
getRight() == 0L){
78 this->
left->getParent()->setLeft(0L);
81 if(this->
left->getRight() != 0L){
89 this->
left->setParent(
this);
96 if(this->
right->remove(data))
104 if(nodeToDelete->
getLeft() == 0L)
107 }
else if ( nodeToDelete->
getRight() == 0L){
114 this->
right->getParent()->setLeft(0L);
117 if(this->
right->getRight() != 0L){
124 this->
right->setParent(
this);
137 std::cout << this->
data <<
" ";
138 std::cout << &this->data << std::endl;
142 virtual bool operator<(const BinarySearchTreeNode<T>& node)
const {
143 return this->
data < node.getData();
void setLeft(BinarySearchTreeNode< T > *node)
Definition: BinarySearchTreeNode.h:162
Definition: BinarySearchTreeNode.h:13
virtual bool operator>(const BinarySearchTreeNode< T > &node) const
Definition: BinarySearchTreeNode.h:146
void setRight(BinarySearchTreeNode< T > *node)
Definition: BinarySearchTreeNode.h:171
T data
Definition: BintreeNode.h:15
Definition: AvalancheTrainingSimulationEngine.h:39
BintreeNode< T > * right
Definition: BintreeNode.h:16
Definition: BintreeNode.h:12
void setParent(BintreeNode< T > *node)
Definition: BintreeNode.h:40
void setData(T data)
Definition: BintreeNode.h:36
virtual void printValue()
Definition: BinarySearchTreeNode.h:135
bool insert(T data)
Definition: BinarySearchTreeNode.h:19
virtual bool operator==(const BinarySearchTreeNode< T > &node) const
Definition: BinarySearchTreeNode.h:150
BinarySearchTreeNode< T > * getLeft()
Definition: BinarySearchTreeNode.h:155
BintreeNode< T > * left
Definition: BintreeNode.h:16
const T getData() const
Definition: BintreeNode.h:35
BinarySearchTreeNode(T _data)
Definition: BinarySearchTreeNode.h:17
BinarySearchTreeNode< T > * getRight()
Definition: BinarySearchTreeNode.h:158