Guest User

Untitled

a guest
Sep 22nd, 2013
20
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public int[] sort(int[] S) {
  2.     int tmp;
  3.  
  4.     for (int i = 1; i < S.length-1; i++) {
  5.         int m = 1;
  6.         for (int j = 2; j < S.length-i; j++) {
  7.             if (S[j-1] > S[m-1]) {
  8.                 m = j;
  9.             }
  10.         }
  11.         if (S[m-1] > S[S.length-i]) {
  12.             tmp = S[S.length-i];
  13.             S[S.length-i] = S[m-1];
  14.             S[m-1] = tmp;
  15.         }
  16.     }
  17.  
  18.     return S;
  19. }
RAW Paste Data