Quicksort

From HaskellWiki
Revision as of 23:08, 19 December 2006 by Ha$kell (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Cea mai scurta implementare de algoritm Quicksort
se poate face in Haskell astfel:

quick :: [Integer] -> [Integer]
quick [] = []
quick (h:t)= quick [ y | y <- t , y < h] ++ [h] ++ quick [ y | y <- t , y > h]

Versiunile in Pascal, C , C++, Java si alte "C-like languages" sunt cam de 10 ori mai lungi.