mirror of https://github.com/xfarrow/lasd.git
Library 4
This commit is contained in:
parent
5406753bbe
commit
f337ff7543
|
@ -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,
|
If the element we are looking the predecessor for is less than the current element,
|
||||||
then we have to go down left the tree.
|
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;
|
NodeLnk* const* pointer = &ref;
|
||||||
|
|
|
@ -450,7 +450,7 @@ void CheckExistence(BST<Data>& tree){
|
||||||
cout<<"\n\nCheck existence in the tree of: ";
|
cout<<"\n\nCheck existence in the tree of: ";
|
||||||
cin>>ws;
|
cin>>ws;
|
||||||
cin>>elementToLookFor;
|
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>
|
template <typename Data>
|
||||||
|
@ -491,7 +491,7 @@ template <typename Data>
|
||||||
void RemoveMin(BST<Data>& bst){
|
void RemoveMin(BST<Data>& bst){
|
||||||
if(bst.Size()>0){
|
if(bst.Size()>0){
|
||||||
bst.RemoveMin();
|
bst.RemoveMin();
|
||||||
cout<<"\n\nThe minimum element has been deleted";
|
cout<<"\n\nThe minimum element has been removed";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cout<<"\n\nTree is empty.";
|
cout<<"\n\nTree is empty.";
|
||||||
|
@ -517,7 +517,7 @@ template <typename Data>
|
||||||
void RemoveMax(BST<Data>& bst){
|
void RemoveMax(BST<Data>& bst){
|
||||||
if(bst.Size()>0){
|
if(bst.Size()>0){
|
||||||
bst.RemoveMax();
|
bst.RemoveMax();
|
||||||
cout<<"\n\nThe maximum element has been deleted";
|
cout<<"\n\nThe maximum element has been removed";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cout<<"\n\nTree is empty.";
|
cout<<"\n\nTree is empty.";
|
||||||
|
|
Loading…
Reference in New Issue