Question: i have a question related to textbook data structures and...
I have a question related to Textbook: Data Structures and Algorithms in Java- Chapter 4 - exercise 63P. The solution posted is unclear and not specific.
This is the exercise 63P:
For each of the algorithms unique1 and unique2, which solve the element uniqueness
problem, perform an experimental analysis to determine the largest value of
n such that the given algorithm runs in one minute or less.
With unique1 and unique2 as follows:
What I want to know is how to calculate the largest value of n. Additionally, while writing program to do experimental analysis, since the two algorithms are used to define uniqueness of elements in array, do we need to initialize array with elements each time the test run to determine its run time?
Right now, what I do is calculating elapsed time of each execution and checking to see if it reaches 60000ms. However, the program takes long time to run and I feel it is not an efficient way to handle this problem. It's clear that both running time of the two algorithms can be expressed in the form of Big-Oh notation. Should we make use of asymptotic analysis in the form of Big-Oh to solve this problem and how?