Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. Algorithm: selectionSort
  2.  
  3. VAR : A[N], i=0, j, stop, cache, r : int
  4. Begin
  5. Do
  6. stop <- 1
  7. For j <- 1+i to N do
  8. cache <- A[j]
  9. If(cache>A[j])
  10. cache <- A[j]
  11. r <- j
  12. stop <- 0
  13. end if
  14. end for
  15. A[r] <- A[i+1]
  16. A[i+1] <- cache
  17. i <- i+1
  18. While(stop=0)
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement