// // File: time_main.C // Author: Chuck Stewart // // Purpose: To experimentally compare unbalanced BST's, AVL trees // and STL sets, which are implemented as red-black trees. The // performance is similar for randomly ordered input but not for // increasing input. // #include #include #include #include #include using namespace std; #include "BSTree.h" int main(int argc, char * argv[]) { int i, n; if ( argc != 2 ) { cerr << "\nUsage: " << argv[0] << " number of integers to insert.\n"; return 0; } n = atoi( argv[1] ); const int num_stars = 50; int increment = n/num_stars; vector shuffled(n); for ( i=0; i avl_int(true); BSTree unbal_bst_int(false); set > set_int; cout << "\nInserting " << n << " randomly shuffled integers into an AVL tree,\n" << "an STL set and a binary search tree with no balancing\n"; cout << "AVL tree: "; for ( i=0; i