Programming Homework Help

COP 3084 Miami Dade College Comparing Sorting Algorithms Project

Get Your Custom Essay Written From Scratch
We have worked on a similar problem. If you need help click order now button and submit your assignment instructions.
Just from $13/Page
Order Now

Challenge 5b – Comparing Sorting Algorithms

1.)  Use the attached skeleton  (I will put in comments the Zip file) and the attached PowerPoint (see below)

to write the driver class that has 3 methods that will accept an array of ints to sort using each of these algorithms:  insertion, selection, & bubble.  Note:  Make sure the sorting is in ASCENDING order!
 

2.)  Write a driver that will do the following:

a.)   Create an array of 20,000 ints (generate the numbers randomly in a loop, in the range of 1 – 5000)

b.)   Call each of the sorting methods, passing it the array of 20,000 ints (Note:  make a copy of the array before sorting the copy).

c.)   Calculate the number of nanoseconds taken to sort the same array, using each of the 3 algorithms.

d.)    Display the time for each.  Say which of the 3 algorithms was fastest (most efficient).

Hint #1: To prove that the algorithm is working, create a small array of 10 randomly generated ints between 1 and 100, and sort them using each of the 3 sorting methods, and print them after each sort. Make a copy of the original array, so that you are re-sorting an unsorted array, instead of the sorted array.  This is proof of concept.

Hint #2:  Make a copy of the original array, so that you use the unsorted version as input to each method.

Hint #3:  Use either System.currentTimeMillis() or System.nanoTime() to get the start and end time assigned to 2 long variables, then subtract, and that is your total time.

Extra Credit:  Do the same for mergeSort and quickSort.

____________________________________________________

Per the syllabus Requirements:

Assignments:

Each week, students will be assigned a CHALLENGE program, which will be started during the lab time, and must be completed and turned in via Canvas by midnight on Sunday. All programming assignments are required to be turned in as “zipped” Netbeans projects, so that the graders can have a consistent means of “unzipping” and testing the programs. 

Ensure your student id, section, and due date appear in the comments of your programming assignments, to give you proper credit. Do not put your name in the comments, since we use anonymous grading.