2020_S19/wk15/lab15.txt
// The purpose of this lab is to generate n unique random integers // into an array, sort the array, and build a balanced BinarySearchTree. // In order to insure the random numbers are unique, we'll insert each // random number into a BST, while "on failed insert" , we'll repeat // generate a new random number and attempt again. // // In addition, we'll also insert each random number into our dynamic // array and a hash table // // Enter an element to search for: elem // // A. // We'll compare search operations with respect to time // - linear search (unsorted array) // - BinarySearchTree search (uglyTree) // - HashTable search (CAP 104729) hash(x): x % CAP // // B. // We'll then sort the given array and build a new // BinarySearchTree in hopes that a balanced BinarySearchTree // will be closer to avg BigO log2(n) and compare search times // // C. // Compare WorstCase for linear sorted array: // - BinarySearch // - Hash Search
Usage: ./lab15Exec <positiveInteger>
Execute the code with several different n sizes and note the times for each search algorithm for each data structure and orderdness. Be testful and try small values and very large values for n size
sortedArrayToBST
and what it is doing