selectionSort(A, N): for i ← 0 to N-2: minj ← minimum(A, i, N) swap(A[i], A[minj])