5 #ifndef VMML_BintreeNode_h
6 #define VMML_BintreeNode_h
19 BintreeNode(T _data): data(_data), left(0L), right(0L), parent(0L){}
21 if(this->left != NULL)
25 if(this->right != NULL)
70 }
else if(this->data == data)
73 }
else if(data < this->data)
75 return this->left->
search(data);
77 return this->right->
search(data);
86 return this->
getLeft()->searchLeftElement();
95 return this->
getRight()->searchRightElement();
100 if(this->right != 0L) {
108 if(this->left != 0L) {
117 std::cout << this->data <<
" ";
122 if(this->left != 0L) {
125 if(this->right != 0L) {
174 std::cout <<
"Binary tree reaches max capacity" << std::endl;
186 virtual bool operator<(const BintreeNode<T>& node)
const {
187 return this->data < node.data;
191 return this->data > node.
data;
195 return this->data == node.
data;
virtual void printInorder()
Definition: BintreeNode.h:120
BintreeNode< T > * parent
Definition: BintreeNode.h:16
T data
Definition: BintreeNode.h:15
virtual void printValue()
Definition: BintreeNode.h:115
virtual void printEuler()
Definition: BintreeNode.h:140
BintreeNode< T > * findInorderPredeccessor()
Definition: BintreeNode.h:107
Definition: AvalancheTrainingSimulationEngine.h:39
BintreeNode< T > * right
Definition: BintreeNode.h:16
BintreeNode< T > * getParent()
Definition: BintreeNode.h:39
BintreeNode< T > * getRight()
Definition: BintreeNode.h:44
Definition: BintreeNode.h:12
BintreeNode< T > * search(T data)
Definition: BintreeNode.h:64
BintreeNode(T _data)
Definition: BintreeNode.h:19
void setParent(BintreeNode< T > *node)
Definition: BintreeNode.h:40
BintreeNode< T > * searchRightElement()
Definition: BintreeNode.h:90
void setData(T data)
Definition: BintreeNode.h:36
virtual bool insert(T data)
Definition: BintreeNode.h:152
virtual bool operator==(const BintreeNode< T > &node) const
Definition: BintreeNode.h:194
BintreeNode< T > * left
Definition: BintreeNode.h:16
void setRight(BintreeNode< T > *node)
Definition: BintreeNode.h:55
~BintreeNode()
Definition: BintreeNode.h:20
const T getData() const
Definition: BintreeNode.h:35
void setLeft(BintreeNode< T > *node)
Definition: BintreeNode.h:46
BintreeNode< T > * getLeft()
Definition: BintreeNode.h:43
virtual bool operator>(const BintreeNode< T > &node) const
Definition: BintreeNode.h:190
BintreeNode< T > * findInorderSuccessor()
Definition: BintreeNode.h:99
BintreeNode< T > * searchLeftElement()
Definition: BintreeNode.h:81
virtual void printPostorder()
Definition: BintreeNode.h:130