Assignment #4 - Sort Comparison


Objectives:

The Assignment:

The Concept:

Your Job:

Geting Started

Time Testing

After implementing some sorting algorithm, you can test how long it will take to sort 100,000 random number. See SortTiming.java for some basic testing method. As in Assignment 2, we will use System.nanoTime() for time measurement. We'll also use the java.util.Random class to get a random number generator.
        // Create the test array :
        Integer[] arr = new Integer[100000];

        java.util.Random random = new java.util.Random();

        // generate random number and put them in the array 
        for(i=0; i < 100000; i++)
           arr[i] = random.nextInt(100000));
      

Generate the random numbers, call one sorting algorithm to sort the random 100,000 numbers, record the time it takes. Repeat the procedure for each soring - there are total of 8 different sorting algorithm.
Create a bar graph of the time testing for all 8 sorting algorithms : Create another bar graph of the time testing for the fast four algorithms :

Submission:

Grading Criteria:

FAQ