Library 3

fixes
This commit is contained in:
Alessandro Ferro 2021-05-10 11:18:55 +02:00
parent a66d40aab3
commit d98a0f766b
1 changed files with 4 additions and 4 deletions

View File

@ -39,7 +39,7 @@ bool BinaryTree<Data>::Node::EqualNodes(const Node& n1, const Node& n2) const{
else if(!n1.HasLeftChild() && n1.HasRightChild()){
return( EqualNodes(n1.RightChild(),n2.RightChild()));
}
else if(n1.IsLeaf()) {
else{ //if leaf
return true;
}
@ -336,11 +336,11 @@ template <typename Data>
struct BinaryTree<Data>::Node* BTPostOrderIterator<Data>::DeepestLeftLeaf(struct BinaryTree<Data>::Node* node){
if(node->HasLeftChild()){
stack.Push(node);
DeepestLeftLeaf(&(node->LeftChild()));
return DeepestLeftLeaf(&(node->LeftChild()));
}
else if(node->HasRightChild()){
stack.Push(node);
DeepestLeftLeaf(&(node->RightChild()));
return DeepestLeftLeaf(&(node->RightChild()));
}
else
return node;
@ -439,7 +439,7 @@ template <typename Data>
struct BinaryTree<Data>::Node* BTInOrderIterator<Data>::MostLeftNode(struct BinaryTree<Data>::Node& root){
if(root.HasLeftChild()){
stack.Push(&root);
MostLeftNode(root.LeftChild());
return MostLeftNode(root.LeftChild());
}else{
return &root;
}