//Put together by stella, Nov 07, for the purposes of lab 11 (on arrays) public class LabArray { public static void main (String [] args) { // Sample arrays for testing the code int[] a = {}; int[] b = {2}; int[] c = {9, -1, 3, 6, -10}; int[] d = {8,3,-21,1000,3112,12}; // Testing code: System.out.println("Testing printArray()"); System.out.print("Array a: "); printArray(a); System.out.print("Array b: "); printArray(b); System.out.print("Array c: "); printArray(c); System.out.print("Array d: "); printArray(d); System.out.println("------------------------------"); System.out.println("Testing selectionSort()"); selectionSort(a); System.out.print("array a sorted w/ selection sort: "); printArray(a); selectionSort(b); System.out.print("array b sorted w/ selection sort: "); printArray(b); selectionSort(c); System.out.print("array c sorted w/ selection sort: "); printArray(c); selectionSort(d); System.out.print("array d sorted w/ selection sort: "); printArray(d); } //--------------------------------------------------------------- //Implements selection sort. //Here is the idea in this method of sorting: //Scan the whole array to select the smallest value. //Exchange it with the value in the first position of the array. //Scan the rest of the array (all but the first value) to find the smallest value. //Exchange it with the value in the second position of the array. //Continue this process for each position in the array. //When complete, the array will be sorted. public static void selectionSort(int[] data) { int min; // for (int index=0; index