[Haskell-cafe] class Ref...

Tomasz Zielonka tomasz.zielonka at gmail.com
Tue Jun 7 16:23:55 EDT 2005


On Tue, Jun 07, 2005 at 12:25:50PM +0200, Gracjan Polak wrote:
> Another question: priority queue. In libraries bundled with ghc we have 
> Data.Queue, but I couldn't find PriorityQueue. Is there somewhere an 
> implementation that everybody uses, but is not in the library?

You can use the new Data.Map module for this (old Data.FiniteMap too,
but a bit more clumsily), it has findMin, findMax, deleteFindMin,
deleteFindMax, deleteMin, deleteMax. All these operations should have
O(log N) cost.

Best regards
Tomasz


More information about the Haskell-Cafe mailing list