Skip to content

Commit

Permalink
added Selection sort
Browse files Browse the repository at this point in the history
  • Loading branch information
firephil committed Mar 17, 2021
1 parent f3f9e8e commit ab74e94
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Haskell-Algorithms.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ executable Haskell-Algorithms
Quicksort,
ShuffleList,
STshuffle,
InsertionSort
InsertionSort,
SelectionSort

hs-source-dirs: app
default-language: Haskell2010
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

#### - InsertionSort

#### - SelectionSort


### Utility Algorithms

#### - Random Shuffle elements of a List (ShuffleList.hs)
Expand Down
8 changes: 8 additions & 0 deletions app/SelectionSort.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module SelectionSort where

import Data.List (minimum, delete)

selectionSort :: Ord a => [a] -> [a]
selectionSort [] = []
selectionSort xs = let { x = minimum xs }
in x : selectionSort (delete x xs)

0 comments on commit ab74e94

Please sign in to comment.