thorax232

Java - Selection Sort (easier, slower)

Nov 8th, 2013
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. public static void selectionSort1(int[] x) {
  2.     for (int i=0; i<x.length-1; i++) {
  3.         for (int j=i+1; j<x.length; j++) {
  4.             if (x[i] > x[j]) {
  5.                 //... Exchange elements
  6.                 int temp = x[i];
  7.                 x[i] = x[j];
  8.                 x[j] = temp;
  9.             }
  10.         }
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment