Personal tools

Quicksort

From HaskellWiki

Revision as of 23:08, 19 December 2006 by Ha$kell (Talk | contribs)

Jump to: navigation, search

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.