Skip to content

Instantly share code, notes, and snippets.

@dstaley
Created July 14, 2014 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstaley/eadcd6af6401fbbe66dc to your computer and use it in GitHub Desktop.
Save dstaley/eadcd6af6401fbbe66dc to your computer and use it in GitHub Desktop.
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