Show me the algorithm!
static public void selection Sort(int [ ] b) {
int k= 0;
//inv: b[0..k-1] is sorted, b[0..k-1] <= b[k..]:
while (k < b.length-1) {
// Set j so that b[j] is the minimum of b[k..b.length-1]
int j= k; int h= k+1;
// inv.:b[j] is minimum of b[k..h-1]
while (h<b.length) {
if (b[h] < b[j]) j= h;
h= h+1; }
// Swap b[k] with b[j]
int t= b[k]; b[k]= b[j]; b[j]= t;
k= k+1;}
Previous slide
Next slide
Back to first slide
View graphic version