[Haskell] Select using MArray

Andreas Farre d00farre at dtek.chalmers.se
Mon Sep 6 10:48:55 EDT 2004


Hi,

I found myself needing to quickly and effectively compute the median of an
array of ordered elements (read as: I want to build a perfectly balanced
kD-tree). Of course there was a nice imperative one, implemented for
language "so-and-so" and "this-and-that" but I couldn't find a Haskell
implementation. So I'd thought I'd give it a go. I used (Select by Floyd
and Rivest):

http://portal.acm.org/citation.cfm?id=360694

wich is mainly targeted for Algol. It turns out that it works rather nice
so I thought I'd post it here so that it could evolve even further (or be
re-implemented), see attachment.

/Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Select.hs
Type: application/octet-stream
Size: 1924 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell/attachments/20040906/58a3c114/Select.obj


More information about the Haskell mailing list