
7 Jun
2005
7 Jun
'05
8:23 p.m.
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