Efficient heaps in purely functional languages

There are a number of Haskell heap implementations in an appendix to Okasaki’s Purely Functional Data Structures (pdf). (The source code can be downloaded at the link. The book itself is well worth reading.) None of them are binary heaps, per se, but the “leftist” heap is very similar. It has O(log n) insertion, removal, … Read more