Last active
July 2, 2020 19:49
-
-
Save Dornhoth/3c31553594ad6f2e28cfef2ee04aa3f5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 insertionSort(array) { | |
| let i = 1; | |
| let x; | |
| while (i < array.length) { | |
| x = array[i] | |
| let j = i - 1; | |
| while (j >= 0 && array[j] > x) { | |
| array[j + 1] = array[j]; | |
| j = j - 1; | |
| } | |
| array[j + 1] = x; | |
| i = i + 1; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment