Question: I need to revise the code to pass multiple tests. One test is: expected output: Test 5 : 1 papa 1 quebec 1 alpha 1

I need to revise the code to pass multiple tests. One test is: expected output: Test5: 1 papa 1 quebec 1 alpha 1 hotel 1 india 1 juliet 1 kilo 1 bravo 1 alpha 1 lima 1 charlie 1 alpha 1 india 1 delta 1 epsilon 1 mike 1 nov 1 oscar 1 foxtrot 1 golf 2 alpha 2 bravo 2 oscar 2 epsilon 2 lima 2 alpha 2 hotel 2 alpha 38
#include "BSTree.h"
#include
using namespace std;
void BSTree::insert(const string& key){
if (root == nullptr){
root = new Node(key);
return;
}
for(Node* curr=root; curr != nullptr;){
}
}
bool BSTree::search(const string& key) const {
throw runtime_error("not done search");
}
string BSTree::largest() const {
return "";
}
string BSTree::smallest() const {
return "";
}
int BSTree::height(const string& key) const {
return height_of(curr);
}
void BSTree::remove(const string& key){
remove(nullptr,root,key);
}
void BSTree::preOrder() const {
preOrder(root);
cout << endl;
}
void BSTree::postOrder() const {
postOrder(root);
cout << endl;
}
void BSTree::inOrder() const {
inOrder(root);
cout << endl;
}
void BSTree::remove(Node* parent, Node* tree, const string& key){
throw runtime_error("not done remove");
}
int BSTree::height_of(Node* tree) const {
throw runtime_error("not done height_of");
}
void BSTree::preOrder(Node* tree) const {
throw runtime_error("not done preOrder");
}
void BSTree::postOrder(Node* tree) const {
throw runtime_error("not done postOrder");
}
void BSTree::inOrder(Node* tree) const {
throw runtime_error("not done inOrder");
}
void BSTree::debug(Node* tree, int indent) const {
if (tree == nullptr) return;
for(int i=0;i<4*indent;++i) cout <<'';
cout << tree <<''<<*tree << endl;
debug(tree->left,indent+1);
for(int i=0;i<4*indent;++i) cout <<'';
cout <<"-"<< endl;
debug(tree->right,indent+1);
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!