Skip to content

Instantly share code, notes, and snippets.

@tarzak
Created December 20, 2013 15:57
Show Gist options
  • Save tarzak/8056764 to your computer and use it in GitHub Desktop.
Save tarzak/8056764 to your computer and use it in GitHub Desktop.
var i, j,
arr = [2,5,1,0],
max = 0,
n = arr.length;
for (i = 1; i < n; i++)
for (j = 0; j < n - 1 ; j++) {
max = arr[j + 1];
if (arr[j] > max) {
arr[j + 1] = arr[j];
arr[j] = max;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment