Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. quickSort :: Ord a => [a] -> [a]
  2. quickSort []     = []                               -- The empty list is already sorted
  3. quickSort (x:xs) = quickSort [a | a <- xs, a < x]   -- Sort the left part of the list
  4.                    ++ [x] ++                        -- Insert pivot between two sorted parts
  5.                    quickSort [a | a <- xs, a >= x]  -- Sort the right part of the list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement