diff --git a/librerie/exercise3/binarytree/binarytree.cpp b/librerie/exercise3/binarytree/binarytree.cpp index a7f62a5..4a8744b 100755 --- a/librerie/exercise3/binarytree/binarytree.cpp +++ b/librerie/exercise3/binarytree/binarytree.cpp @@ -39,7 +39,7 @@ bool BinaryTree::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 struct BinaryTree::Node* BTPostOrderIterator::DeepestLeftLeaf(struct BinaryTree::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 struct BinaryTree::Node* BTInOrderIterator::MostLeftNode(struct BinaryTree::Node& root){ if(root.HasLeftChild()){ stack.Push(&root); - MostLeftNode(root.LeftChild()); + return MostLeftNode(root.LeftChild()); }else{ return &root; }