Question: #include MyDinosaurDatabase.hpp #include #include namespace CPSC 1 3 1 ::Databases::Dinosaurs { MyDinosaurDatabase::MyDinosaurDatabase ( ) { / / / Insert a Dinosaur record into the
#include "MyDinosaurDatabase.hpp
#include
#include
namespace CPSC::Databases::Dinosaurs
MyDinosaurDatabase::MyDinosaurDatabase
Insert a Dinosaur record into the database
void MyDinosaurDatabase::insertconst Dinosaur& dino
TODO: Your code here
Check if a Dinosaur record exists in the database
bool MyDinosaurDatabase::existsconst Dinosaur& dino const
TODO: Your code here
return false;
Return a Dinosaur record from the database to the caller
For all methods here that take an incoming Dinosaur object,
the caller expects to create an empty Dinosaur object
with only the ID field filled out.
When the Dinosaur class has its comparison operators
overloaded properly, the BST will be able to locate
the correct Dinosaur entry in the tree using just the ID field.
Dinosaur& MyDinosaurDatabase::findconst Dinosaur& dino
TODO: Your code here
return new Dinosaur;
Remove a Dinosaur entry from the database.
void MyDinosaurDatabase::removeconst Dinosaur& dino
TODO: Your code here
Iterate all Dinosaur records using preorder traversal.
void MyDinosaurDatabase::traversePreOrder
std::function callback
TODO: Your code here
Iterate Dinosaur records with inorder traversal
const version
void MyDinosaurDatabase::traverseInOrder
std::function boolconst DinoTree& std::sharedptr callback const
TODO: Your code here
Iterate Dinosaur records with inorder traversal
nonconst version
void MyDinosaurDatabase::traverseInOrder
std::function boolDinoTree& std::sharedptr callback
TODO: Your code here
Iterate Dinosaur records with postorder traversal
nonconst
void MyDinosaurDatabase::traversePostOrder
std::function boolDinoTree& std::sharedptr callback
TODO: Your code here
Iterate Dinosaur records with levelorder traversal
nonconst
void MyDinosaurDatabase::traverseLevelOrder
std::function boolDinoTree& std::sharedptr callback
TODO: Your code here
Return the computed height of the database's internal BST
sizet MyDinosaurDatabase::computeHeight
TODO: Your code here
return ;
Return the number of records in the database
sizet MyDinosaurDatabase::size
TODO: Your code here
return ;
Return true if the database if empty; false otherwise
bool MyDinosaurDatabase::empty
TODO: Your code here
return false;
Clear the entire database
void MyDinosaurDatabase::clear
TODO: Your code here
Return a reference to the internal binary search tree
DinoTree& MyDinosaurDatabase::tree
TODO: Your code here
return new DinoTree;
Class MyBST
MyBST;
MyBSTconst MyBST& other;
~MyBST;
void insertT value;
T& findT value;
std::sharedptr findnodeT value const;
void removeT value;
void removestd::sharedptr node;
bool existsT value const;
std::sharedptr getRoot const;
bool isRootconst std::sharedptr& node const;
bool isInternalconst std::sharedptr& node const;
bool isExternalconst std::sharedptr& node const;
bool isLeafconst std::sharedptr& node const;
bool isParentconst std::sharedptr& node const;
bool hasParentconst std::sharedptr& node const;
sizet getChildCountconst std::sharedptr& node const;
bool hasOneChildconst std::sharedptr& node const;
bool hasTwoChildrenconst std::sharedptr& node const;
bool isLeftChildconst std::sharedptr& node const;
bool hasLeftChildconst std::sharedptr& node const;
bool isRightChildconst std::sharedptr& node const;
bool hasRightChildconst std::sharedptr& node const;
void traversePreOrderstd::function callback;
void traverseInOrderstd::function callback const;
void traverseInOrderstd::function callback;
void traversePostOrderstd::function callback;
void traverseLevelOrderstd::function callback const;
void traverseLevelOrderstd::function callback;
void clear;
bool empty const;
sizet size const;
std::sharedptr getDeepestLeaf;
sizet computeHeight;
std::string renderToDot const;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
