Question: This is the code that I currently have. Need help with creating the rest. #include avl_tree.h //#include avl_tree_modified.h //#include sequence_map.h // You will have to

This is the code that I currently have. Need help with creating the rest.

#include "avl_tree.h" //#include "avl_tree_modified.h" //#include "sequence_map.h" // You will have to add #include "sequence_map.h"

#include #include using namespace std;

namespace {

// @db_filename: an input database filename. // @seq_filename: an input sequences filename. // @a_tree: an input tree of the type TreeType. It is assumed to be // empty. template void TestTree(const string &db_filename, const string &seq_filename, TreeType &a_tree) { // Code for running Part2(b) }

} // namespace

int main(int argc, char **argv) { if (argc != 3) { cout " with AvlTree AvlTree a_tree; TestTree(db_filename, seq_filename, a_tree);

return 0; }

This is the code that I currently have. Need help with creating

Next, create a test routine named test_tree that does the following in the sequence described below: a. 6.9 a. 1. Parses the database and construct a search tree (this is the same as in Part2(a)). 2. Prints the number of nodes in your tree n. 3. Computes the average depth of your search tree, i.e. the internal path length divided by n. Prints the average depth. b. Prints the ratio of the average depth to log2 n. E.g., if average depth is 6.9 and log2 n = 5.0, then you should print = 1.38. 5.0 4. Searches (find()) the tree for each string in the sequences.txt file and counts the total number of recursive calls for all executions of find(). Prints the total number of successful queries (number of strings found). b. Prints the average number of recursion calls, i.e. #total number of recursion calls / number of queries. 5. Removes every other sequence in sequences.txt from the tree and counts the total number of recursion calls for all executions of remove(). Prints the total number successful removes. b. Prints the average number of recursion calls, i.e. #total number of recursion calls / number of remove calls. 6. Redo steps 2 and 3: Prints number of nodes in your tree. b. Prints the average depth. c. Prints the ratio of the average depth to log2 n. a. a. Next, create a test routine named test_tree that does the following in the sequence described below: a. 6.9 a. 1. Parses the database and construct a search tree (this is the same as in Part2(a)). 2. Prints the number of nodes in your tree n. 3. Computes the average depth of your search tree, i.e. the internal path length divided by n. Prints the average depth. b. Prints the ratio of the average depth to log2 n. E.g., if average depth is 6.9 and log2 n = 5.0, then you should print = 1.38. 5.0 4. Searches (find()) the tree for each string in the sequences.txt file and counts the total number of recursive calls for all executions of find(). Prints the total number of successful queries (number of strings found). b. Prints the average number of recursion calls, i.e. #total number of recursion calls / number of queries. 5. Removes every other sequence in sequences.txt from the tree and counts the total number of recursion calls for all executions of remove(). Prints the total number successful removes. b. Prints the average number of recursion calls, i.e. #total number of recursion calls / number of remove calls. 6. Redo steps 2 and 3: Prints number of nodes in your tree. b. Prints the average depth. c. Prints the ratio of the average depth to log2 n. a. a

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 Databases Questions!