Selection sorting an array A[0, 1, 2, ..., n-1]
01 SelectionSort(A[0, 1, 2, ..., n-1])
02 for (j <- 0) to (n-2) do
03 m <- j
04 for (i <- j+1) to (n-1) do
05 if A[m] > A[i] then
06 m <- i
07 end if
08 end for
09 exchange A[m] <-> A[j]
10 end for
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment