Skip to content

Instantly share code, notes, and snippets.

@imgsrc
Last active August 23, 2018 18:05
Show Gist options
  • Save imgsrc/761c75e53cfb04506bf24e3cca406327 to your computer and use it in GitHub Desktop.
Save imgsrc/761c75e53cfb04506bf24e3cca406327 to your computer and use it in GitHub Desktop.
Сортировка пузырьком
var m = [1, 7, 5, 13, 8],
count = m.length - 1,
max;
for (var i = 0; i < count; i++) {
for (var j = 0; j < count - i; j++) {
if (m[j] > m[j + 1]) {
max = m[j];
m[j] = m[j + 1];
m[j + 1] = max;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment