Created
March 20, 2018 18:42
-
-
Save sorindragan/066cf27f092ecd7e22220dc8def516de to your computer and use it in GitHub Desktop.
InsertionSort algorithm in Haskell
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
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