We discussed in class how Merge Sort is more efficient than Selection sort (O(n log n) vs. O(n2)). In this assignment you are asked to run the two algorithms on random arrays of different sizes and produce a table of running times. You can use the codes for the two techniques posted on Isidore or use the code from the textbook. In your program put a comment to show whether you are using the book’s sorting code or the code from Isidore. You are welcome to write your own code as well. 
The program should have two output sections. In the first section you create random arrays of size 20 (limit values to 100), and demonstrate that selection sort and merge sort as implemented by you work to sort the array. In the second section you collect timing data from sorting random arrays of various sizes using both selection sort and merge sort and display the results in a table. See sample output. When running this program to collect final results for submission, close all other applications. For collecting timing data, use rand.nextInt(), without using any specified range. 

Published by
Ace Tutors
View all posts