可以用JAVA进行选择排序:
1 // selectSort.java 2 // demonstrates selection sort 3 // to run this program: C>java SelectSortApp 4 5 package SelectSortApp; 6 7 class ArraySel 8 { 9 private long[] a; // ref to array a10 private int nElems; // number of data items11 //--------------------------------------------------------------12 public ArraySel(int max) // constructor13 {14 a = new long[max]; // create the array15 nElems = 0; // no items yet16 }17 //--------------------------------------------------------------18 public void insert(long value) // put element into array19 {20 a[nElems] = value; // insert it21 nElems++; // increment size22 }23 //--------------------------------------------------------------24 public void display() // displays array contents25 {26 for(int j=0; j