Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. selectionsort
  2. for(int pass = 0; pass < set.length-1; pass++)
  3. {
  4. int smallestIndex = pass;
  5. for(int position = pass+1; position <set.length; position++)
  6. {
  7. if(set[smallestIndex] > set[position])
  8. {
  9. smallestIndex=position;
  10. }
  11. }
  12. double temp = set[smallestIndex];
  13. set[smallestIndex] = set[pass];
  14. set[pass] = temp;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement