-
-
Save eengineergz/80934783c628c70ac2a5a48119a82d54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bubbleSort(items) { | |
let length = items.length; | |
for (let i = 0; i < length; i++) { | |
for (let j = 0; j < length - i - 1; j++) { | |
if (items[j] > items[j + 1]) { | |
let tmp = items[j]; | |
items[j] = items[j + 1]; | |
items[j + 1] = tmp; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment