/**************************************************************** FILE: prog5.cc AUTHOR: Anthony Hogan LOGON ID: Z109079 DUE DATE: 4/11/08 PURPOSE: This contains the need #includes and class definition so that it is not used more than once in the progam ****************************************************************/ #include "BST.h" int main() { int n = 10; vector vec; BSTree tree; vector::iterator theIterator = vec.begin(); for (int i = 0; i <= n; i++) { vec.push_back( rand() % n + 1 ); tree.insert(rand() % n + 1); } bool isFound = false; double countFound = 0, searchCount = 0, precSucc = 0; for(theIterator = vec.begin(); theIterator != vec.end(); theIterator++) { isFound = tree.search(*theIterator,n); if (isFound == true) { countFound++; isFound = false; } searchCount++; } tree.printTree(tree.root); /* cout << "BST:" << endl; cout << " Number of Node: SOME VALUE??? " << endl; cout << " Number of leaves: " << tree.leaves() << endl; cout << " Height of tree " << tree.height() << endl; cout << endl; precSucc = (countFound/searchCount) * 100; cout << "Ratio of successful searches for 'BST' is " << precSucc << endl; cout << "Successfull Searches: " << countFound << " Total # search: " << searchCount << endl; cout << "Average search length for 'BST' is SOME VALUE " << endl; cout << endl; cout << "The elements of 'BST' in inOrder:" << endl; tree.printTree(tree.root); */ system("PAUSE"); return 0; }