Custopootimus

Four Line Optimized Bubble Sort

Sep 30th, 2012
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.20 KB | None | 0 0
  1. private static int[] bubbleSort(int[] sort) {
  2.     for(int i, t, a=1, x=sort.length; a==1; x--)
  3.         for (i=1, a=0; i < x; i++)
  4.             for(a=1; (t=sort[i-1]) > sort[i]; sort[i-1]=sort[i], sort[i]=t);
  5.     return sort;
  6. }
Advertisement
Add Comment
Please, Sign In to add comment