Skip to content

Commit

Permalink
Create Quicksort
Browse files Browse the repository at this point in the history
  • Loading branch information
iammuhit committed Dec 26, 2020
1 parent b98d5fe commit b51696c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions quicksort.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) =
let smallerSorted = quicksort [a | a <- xs, a <= x]
biggerSorted = quicksort [a | a <- xs, a > x]
in smallerSorted ++ [x] ++ biggerSorted

0 comments on commit b51696c

Please sign in to comment.