Never underestimate teh power of the Int{Set,Map}:
{-# LANGUAGE BangPatterns #-}
import Data.Set(Set)
import Data.IntSet(IntSet)
import qualified Data.Set as S
import qualified Data.IntSet as IS
import Control.Parallel.Strategies(rnf)
import Data.Monoid(Monoid(..))
import Data.List
findsumsIS ::
On Sunday 19 July 2009 09:26:14 Heinrich Apfelmus wrote:
> Thomas Hartman wrote:
> > The code below is, I think, n log n, a few seconds on a million + element
> > list.
> >
> > I wonder if it's possible to get this down to O(N) by using a
> > hashtable implemementation, or other better data structu
Thomas Hartman wrote:
> The code below is, I think, n log n, a few seconds on a million + element
> list.
>
> I wonder if it's possible to get this down to O(N) by using a
> hashtable implemementation, or other better data structure.
>
> -- findsums locates pairs of integers in a list
> that add