@Test public void sort() { int[] ary = generatorArray(100); for (int i = 0; i < ary.length; i++) { int minIndex = i; for (int j = i + 1; j < ary.length; j ++) { if (ary[j] < ary[minIndex]) { minIndex = j; } } Helper.swap(ary, i, minIndex); } for (int i = 0; i < ary.length; i++) { System.out.println(ary[i]); } }
public static int[] sort (int[] args) { for (int i = 0; i < args.length; i++) { int minIndex = i; for (int j = i + 1; j < args.length; j++) if (args[j] < args[minIndex]) minIndex = j; Helper.swap(args, minIndex, i); } return args; }
SelectionSort { public static int[] sort (int[] args) { for (int i = 0; i < args.length; i++) { int minIndex = i; for (int j = i + 1; j < args.length; j++) if (args[j] < args[minIndex]) minIndex = j; Helper.swap(args, minIndex, i); } return args; } }
SelectionSort { public static int[] sort (int[] args) { for (int i = 0; i < args.length; i++) { int minIndex = i; for (int j = i + 1; j < args.length; j++) if (args[j] < args[minIndex]) minIndex = j; Helper.swap(args, minIndex, i); } return args; } private  SelectionSort(); }
SelectionSort { public static int[] sort (int[] args) { for (int i = 0; i < args.length; i++) { int minIndex = i; for (int j = i + 1; j < args.length; j++) if (args[j] < args[minIndex]) minIndex = j; Helper.swap(args, minIndex, i); } return args; } private  SelectionSort(); static int[] sort(int[] args); }
SelectionSort { public static int[] sort (int[] args) { for (int i = 0; i < args.length; i++) { int minIndex = i; for (int j = i + 1; j < args.length; j++) if (args[j] < args[minIndex]) minIndex = j; Helper.swap(args, minIndex, i); } return args; } private  SelectionSort(); static int[] sort(int[] args);  }