Home » Sorting

# Sorting

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:

1. Verbal Explanation of Sorting Method
2. Visualization using cups
3. Video explaining cups
4. Code implementation
5. Testing
By the end of this lesson you will be able to:
1. Explain each sorting method
2. Demonstrate visually each sorting method
3. 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[ ]) {

}

}