Class pratice for April 13th, CS 106

Previously: We discussed selection sort and bubble sort in class.

Today: In groups of two or three, fill in the class Sorting.java.

First, look at how the array is initialized and then sorted. You don't need to understand quicksort, but do notice that I've included a swap method for you to use.

Second, write up code for the selection sort and use it to sort your array. Make sure it works.

Third, write up code for the bubble sort and use it to sort your array. Again, test your code.

Fourth, compare the running time of selection sort, bubble sort, and quick sort. How large does the array have to be before you notice a difference? Can you detect a difference with 100 elements? 1,000? 100,000? Note that when sorting lots of numbers you may not want to print the entire array to the screen.