This heap implementations supports an arbitrary element type, via a comparison
function. If you need a heap with elements ordered by integers, then it may be more
efficient to use a
Timing_wheel.Priority_queue, which is a heap implementation
specialized to integer keys, and with some other performance differences and usage
module Removable :
module Elt :
add_removable t vadds
t, returning a token that can be used to delete
tin lg(n) amortized time.
tokenare mismatched then behavior is undefined.
removemay safely be called on a token more than once. This doesn't free all the memory associated with the Elt until some number of
popoperations later -- see Heap_intf for details.
update t token vis shorthand for
remove t token; add_removable t v
find_elt t ~f. If
fis true for some element in
t, return a
Elt.tfor that element. This operation is O(n).