Question: I have a question related to Textbook: Data Structures and Algorithms in Java- Chapter 4 - exercise 63P. The solution posted is unclear and not

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:

I have a question related to Textbook: Data Structures and Algorithms in

Java- Chapter 4 - exercise 63P. The solution posted is unclear and

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?

1Returns true if there are no duplicate elements in the array. * 2 public static boolean unique1 (int ] data) 3 int n data.length; 4 for (int j-0; j

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!