Created
July 14, 2014 01:37
-
-
Save dstaley/eadcd6af6401fbbe66dc 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
func jortSort<T:Comparable>(inout array: [T]) -> Bool { | |
// sort the array | |
let originalArray = array | |
array.sort({$0 < $1}) | |
// compare to see if it was originally sorted | |
for var i = 0; i < originalArray.count; ++i { | |
if originalArray[i] != array[i] { return false } | |
} | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment