Question: Fix the class MethodTester that contains a main method and three static helper methods, one to implement each algorithm above. Your main method should test

Fix the class MethodTester that contains a main method and three static helper methods, one to implement each algorithm above. Your main method should test your methods with small arrays (like the ones in the examples above) so you know they work correctly before moving on.
Once you know the algorithms work correctly, run the class named RuntimeAnalyzer that contains the methods to quantify the algorithms.
The class measures the time that your computer spends processing the algorithm using:
long startTime = System.currentTimeMillis(); // record the starting time
/*(run the algorithm)*/
long endTime = System.currentTimeMillis(); // record the ending time
long elapsed = endTime - startTime;
If your computer is too fast, use:
long startTime = System.nanoTime ();?? record the starting time
/*(run the algorithm)*/
long endTime = System. nanoTime(); // record the ending time
long elapsed = endTime - startTime;
This class will run your algorithms for randomly generated arrays of size 5,10,15,dots, up to 50. For each array size, it will generate 20 arrays (one at a time) and run the algorithms with each array, averaging the returned number of assignment statements executed for each algorithm separately.
 Fix the class MethodTester that contains a main method and three

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!