Alluring experiments with sorting algorithms, sort of
Swift
Latest commit bb77643 Jan 4, 2017 @adrfer committed on GitHub Revert last commit

README.md

Sort

Alluring experiments with sorting algorithms, sort of.

Tested against Swift 3 and Xcode 8.

Welcome to the Sort Playground!

This is about exploring alternative implementations of different sorting techniques written in Swift. To move from disarray to order when managing collections of data, some variations of these sorting algorithms are provided, starting with a classic implementation that is then forged over and over until it becomes more idiomatic, or simply, more Swift-y.

Indulge yourself with the following takes:

  • The Classic: a die-hard style, rooted in tradition, in all its imperative glory
  • The Swift-ish: a sligthly more modern take on the classic, but still not quite quaint enough
  • The Swiftest: a nifty approach that attempts to tap into the most powerful features of the language yet
  • The Generic: a play on the swiftest version, but elevated to a type-agnostic nirvana status
  • The Functional: a quirky take that unleashes some of the neat declarative aspects of the language
  • The Bonus: a twist on both the swift-ish and generic versions that takes an ordering predicate

Also, a few test cases covering some initial conditions are included:

  • Sorted
  • Nearly Sorted
  • Reversed
  • Shuffled

I know, I know... Talk is cheap, show me the code, right?

Table of Contents

Note: Remember, the focus of this playground is experimentation, learning, and having fun. Do not expect any crazy award-winning performant code ahead, ok?

Feel free to ping me on Twitter.