Library 4

This commit is contained in:
Alessandro Ferro 2021-05-23 15:58:22 +02:00
parent 5406753bbe
commit f337ff7543
2 changed files with 3 additions and 8 deletions

View File

@ -321,11 +321,6 @@ typename BST<Data>::NodeLnk* const* BST<Data>::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;

View File

@ -450,7 +450,7 @@ void CheckExistence(BST<Data>& 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 <typename Data>
@ -491,7 +491,7 @@ template <typename Data>
void RemoveMin(BST<Data>& 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 <typename Data>
void RemoveMax(BST<Data>& 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.";