YCP Logo Lab 19: Benchmarking Insertion Sort

Due: Friday, Nov 21 by 11:59 PM

Getting Started

Import CS201_Lab19.zip (File->Import...->General->Existing Projects into Workspace->Archive File). You should see a project called CS201_Lab19 in the Package Explorer.

Your Task

Benchmark the amount of time required to execute an implementation of the Insertion Sort algorithm on unsorted and sorted arrays of size 10,000, 20,000, 30,000, etc., up to and including size 100,000.

Add your code the main method of the Benchmark class. An implementation of Insertion Sort is provided as the Sort.insertionSort static method.

Output your data points in the form

size,unsortedTime,alreadySortedTime

where size is the problem size, unsortedTime is the amount of time in milliseconds needed to run Sort.insertionSort on an unsorted array, and alreadySortedTime is the amount of time in milliseconds to execute Sort.insertionSort again on the already sorted array. Use the System.currentTimeMillis method to collect the times.

Your output should look something like this:

10000,412,9
20000,933,2
30000,2952,8
40000,10551,2
50000,19361,3
60000,29939,4
70000,43533,5
80000,61940,6
90000,80173,7
100000,113330,9

Your times will likely be different, but the overall trend should be similar.

Plot the data in excel: your plot should look something like the following:

figures/lab19-benchPlot.png

Copy your Excel file into the Eclipse project. (Put it in the subdirectory of your Eclipse workspace called CS201_Lab19, and in Eclipse right-click on the project and choose Refresh.)

Submit

Make sure that you have included your Excel file in the project!

When you are done, save the project (CS201_Lab19) to a zip file by right-clicking it and choosing

Export...->Archive File

Upload the saved zip file to the Marmoset server as lab19. The server URL is

https://camel.ycp.edu:8443/