From f337ff7543e5a16bf219cc7177375387a7a2aa1b Mon Sep 17 00:00:00 2001 From: Alessandro Ferro <49845537+xfarrow@users.noreply.github.com> Date: Sun, 23 May 2021 15:58:22 +0200 Subject: [PATCH] Library 4 --- librerie/exercise4/bst/bst.cpp | 5 ----- librerie/exercise4/zmytest/test.cpp | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/librerie/exercise4/bst/bst.cpp b/librerie/exercise4/bst/bst.cpp index c84d4c4..4822100 100755 --- a/librerie/exercise4/bst/bst.cpp +++ b/librerie/exercise4/bst/bst.cpp @@ -321,11 +321,6 @@ typename BST::NodeLnk* const* BST::FindPointerToPredecessor(struct B If the element we are looking the predecessor for is less than the current element, then we have to go down left the tree. - - - Note: I return a ** instead of *& because we deferenciate a variable that might - contain nullptr (candidate) that, without proper handling, would result to - an invalid read. I decided to keep it simpler to understand. */ NodeLnk* const* pointer = &ref; diff --git a/librerie/exercise4/zmytest/test.cpp b/librerie/exercise4/zmytest/test.cpp index 201fec9..a20aeb5 100755 --- a/librerie/exercise4/zmytest/test.cpp +++ b/librerie/exercise4/zmytest/test.cpp @@ -450,7 +450,7 @@ void CheckExistence(BST& tree){ cout<<"\n\nCheck existence in the tree of: "; cin>>ws; cin>>elementToLookFor; - cout<<"The element " << ( (!tree.Exists(elementToLookFor))? "does not " : "") << "exists\n\n"; + cout<<"The element " << ( (tree.Exists(elementToLookFor))? "does" : "does not") << " exist\n\n"; } template @@ -491,7 +491,7 @@ template void RemoveMin(BST& bst){ if(bst.Size()>0){ bst.RemoveMin(); - cout<<"\n\nThe minimum element has been deleted"; + cout<<"\n\nThe minimum element has been removed"; } else cout<<"\n\nTree is empty."; @@ -517,7 +517,7 @@ template void RemoveMax(BST& bst){ if(bst.Size()>0){ bst.RemoveMax(); - cout<<"\n\nThe maximum element has been deleted"; + cout<<"\n\nThe maximum element has been removed"; } else cout<<"\n\nTree is empty.";