/******************************************************* Proj3.C CMSC-341 Spring 2004 Project3 Spencer Shimko, Section 001, sshimko1 Created: 13 March 2004 Current: 13 March 2004 Binary Search Trees: Finds the median, height, weight balanced tree I have read and I understand the course policy on cheating. By submitting the following program, I am stating that the program was produced by my individual effort. *********************************************************/ #include #include "Proj3Aux.H" #include "BinarySearchTree.H" using namespace std; // Begin main int main( int argc, const char* argv[] ){ // usage for command const char* USAGE = "Usage: ./Proj3 seed treenodes printheight"; if ( argc != 4 ){ cout << USAGE << endl; return 1; } // convert command line to integer equivalents int seed = atoi(argv[1]); int node = atoi(argv[2]); int height = atoi(argv[3]); // create binary tree of ints full of random node*numbers based on seed BinarySearchTree < int > bt = CreateBinaryTree ( seed, node ); // Display pre-balanced tree cout << "Before balancing the level order output is: " << endl; DisplayTreeData ( bt, height ); // balance tree bt.weightBalance ( ); // display balanced tree cout << "After balancing the level order output is: " << endl; DisplayTreeData ( bt, height ); }