Skip to content

Instantly share code, notes, and snippets.

@sorindragan
Created March 20, 2018 18:42
Show Gist options
  • Save sorindragan/066cf27f092ecd7e22220dc8def516de to your computer and use it in GitHub Desktop.
Save sorindragan/066cf27f092ecd7e22220dc8def516de to your computer and use it in GitHub Desktop.
InsertionSort algorithm in Haskell
sort [] = []
sort [x] = [x]
sort (x:xs) = insert (sort xs)
where insert [] = [x]
insert (y:ys) | x <= y = x : y : ys
| otherwise = y : insert ys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment