Skip to content

Commit 042ded2

Browse files
authored
Merge pull request #606 from nasanos/quick_sort-FSharp
Added quick sort in F#
2 parents 2ccfb15 + 036e5a0 commit 042ded2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sorting/quick_sort/quick_sort.fsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let rec quicksort list =
2+
match list with
3+
| [] -> []
4+
| x::xs ->
5+
let smaller, larger = List.partition (fun y -> y < x) xs
6+
in List.concat [quicksort smaller; [x]; quicksort larger]

0 commit comments

Comments
 (0)