http://www.verejava.com/?id=16992690199232
/* Sort by Selection: Idea: 1. Select the smallest of the remaining unordered elements in the array, insert the */public class Selectsort {public static void sort (i Nt[] arrays) {int minindex;//Save the index of the selected minimum for (int i = 0; i < arrays.length-1; i++) {minindex=i ; int minvalue=arrays[minindex];//The value of the first element of the loop that holds the minimum value for Each loop for (int j = i; J < Arrays.length-1; J + +) { Compare with each element if the value is less than the minimum value and the index of the saved interchange value is the minimum index if (minvalue>arrays[j+1]) {minvalue=arrays[j+1 ]; minindex=j+1; }} if (I!=minindex)//Determine if the minimum value index changes the current minimum value with the last element to sort {int temp=arrays[i]; Arrays[i]=arrays[minindex]; Arrays[minindex]=temp; }}} public static void Main (string[] args) {int[] scores={90,70,50,80,60,85}; Sort (scores); for (int score:scores) {System.out.print (score+ ","); } }}
http://www.verejava.com/?id=16992690199232
One dimension array selection sorting algorithm in Java array