A collection of 3 posts


Purely Functional Data Structures & Algorithms : Selection Sort

*Updated @ 2012-08-31 02:08:58 due to internet pedantry* Previously, previously. According to Wikipedia : In computer science, a Selection sort is a sorting algorithm, specifically an in-place comparison sort. It has O(n2) time complexity, making it inefficient on large lists, and generally performs

Functional Programming

Purely Functional Data Structures & Algorithms : Union-Find (Haskell)

*Updated 08-23-2012 01:04:38* Replaced the use of Data.Vector with the persistent Data.Sequence which has O(logN) worst case time complexity on updates. A Haskell version of the previous code using the more efficient(access and update) persistent Data.Sequence type

Functional Programming

Generating π in Haskell

Haskell beats CL quite comfortably using the same algorithm : module Main( main ) where import System( getArgs ) arccot :: Integer -> Integer -> Integer arccot x unity = arccot' x unity 0 start 1 1 where start = unity `div` x arccot' x unity sum xpower n sign