Last active
May 12, 2018 15:48
-
-
Save BrianLitwin/64a415c08cfd4924873f6c9a51ec4975 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
func mergeSort(_ array: inout [Int], _ temp: inout [Int?], _ leftStart: Int, _ rightEnd: Int) { | |
guard leftStart < rightEnd else { return } | |
let middle = (leftStart + rightEnd) / 2 | |
mergeSort(&array, &temp, leftStart, middle) | |
mergeSort(&array, &temp, middle + 1, rightEnd) | |
mergeHalves(&array, &temp, leftStart, rightEnd) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment