mirror of https://github.com/xfarrow/lasd.git
parent
a66d40aab3
commit
d98a0f766b
|
@ -39,7 +39,7 @@ bool BinaryTree<Data>::Node::EqualNodes(const Node& n1, const Node& n2) const{
|
||||||
else if(!n1.HasLeftChild() && n1.HasRightChild()){
|
else if(!n1.HasLeftChild() && n1.HasRightChild()){
|
||||||
return( EqualNodes(n1.RightChild(),n2.RightChild()));
|
return( EqualNodes(n1.RightChild(),n2.RightChild()));
|
||||||
}
|
}
|
||||||
else if(n1.IsLeaf()) {
|
else{ //if leaf
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,11 +336,11 @@ template <typename Data>
|
||||||
struct BinaryTree<Data>::Node* BTPostOrderIterator<Data>::DeepestLeftLeaf(struct BinaryTree<Data>::Node* node){
|
struct BinaryTree<Data>::Node* BTPostOrderIterator<Data>::DeepestLeftLeaf(struct BinaryTree<Data>::Node* node){
|
||||||
if(node->HasLeftChild()){
|
if(node->HasLeftChild()){
|
||||||
stack.Push(node);
|
stack.Push(node);
|
||||||
DeepestLeftLeaf(&(node->LeftChild()));
|
return DeepestLeftLeaf(&(node->LeftChild()));
|
||||||
}
|
}
|
||||||
else if(node->HasRightChild()){
|
else if(node->HasRightChild()){
|
||||||
stack.Push(node);
|
stack.Push(node);
|
||||||
DeepestLeftLeaf(&(node->RightChild()));
|
return DeepestLeftLeaf(&(node->RightChild()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return node;
|
return node;
|
||||||
|
@ -439,7 +439,7 @@ template <typename Data>
|
||||||
struct BinaryTree<Data>::Node* BTInOrderIterator<Data>::MostLeftNode(struct BinaryTree<Data>::Node& root){
|
struct BinaryTree<Data>::Node* BTInOrderIterator<Data>::MostLeftNode(struct BinaryTree<Data>::Node& root){
|
||||||
if(root.HasLeftChild()){
|
if(root.HasLeftChild()){
|
||||||
stack.Push(&root);
|
stack.Push(&root);
|
||||||
MostLeftNode(root.LeftChild());
|
return MostLeftNode(root.LeftChild());
|
||||||
}else{
|
}else{
|
||||||
return &root;
|
return &root;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue