To help show the relevance of sorting, let’s brainstorm some ideas on where you see sorting. Let’s collaborate here!
For each sorting method, we will be using the same array with the LOST values: 4, 8, 15, 16, 23, and 42. Our progression will work as following:
- Verbal Explanation of Sorting Method
- Visualization using cups
- Video explaining cups
- Code implementation
- Testing
- Explain each sorting method
- Demonstrate visually each sorting method
- Code each algorithm
To begin, read the tester code and click on the accompanying inside of the sort method.
A class for testing sorting routines:
Test the various methods of sorting with the following code:
public class Tester {
public static void main(String args[]) {
int theArray[] = {4, 8, 15, 16, 23, 42};
sort(theArray);
for(int j = 0; j < theArray.length; j++) {
System.out.print(theArray[j] + ” “); }
System.out.println(” “); }
public static void sort(int a[ ]) {
}
}