32 ms·
If anyone's wondering, yes, there's a quickSort function already in the Swift standard library (no import required): var ar = [3456,45,53567,356,7225,47858
by gilgoomesh 12y ago
If anyone's wondering, yes, there's a quickSort function already in the Swift standard library (no import required):
var ar = [3456,45,53567,356,7225,47858]
quickSort(&ar, Range(start: ar.startIndex, end: ar.endIndex))
// [45, 356, 3456, 7225, 47858, 53567]
There's also a version that let's you specify the "less" comparator.
- jkubicek 12y agoHow did you discover this?
- gilgoomesh 12y agoUse a Swift standard library function in the documentation (like println). Command-Click on it to go to it's definition. You're taken to a header-like description of the standard library (assuming the index has been built for your project – sometimes you have to wait a few minutes in a new project).