Bounded_min_heap.MakeMake (ID) (E) creates a min heap for element of type E.t using the E.compare function. The heap is bounded and adding more elements than its capacity will fail. The module ID is used to check if an element already exists at insertion.
module E : sig ... endval create : int -> tcreate capacity creates a bounded sequence of at most capacity elements.
Raise Invalid_argument if size < 0 or size > Sys.max_array_length.
insert e h adds element e to bounded sequence h if h is not full.
Worst-case complexity: O(log n) where n is the capacity of the heap.
If there is an element e' with E.id e' = E.id e, it will be replaced iff E.compare e e' < 0 .
peek_min h returns, without removing, the smallest element from the heap h, None if empty.
elements h returns the contents of h as a sorted list in increasing order according to E.compare.
Worst-case complexity: O(n log n) where n is the size of the heap.
val length : t -> intlength h is the number of elements held by h.
mem elt h returns true is the elt already exists in h, i.e. E.compare returns 0.
find id h returns the first elements of h, that as E.id e = id is true.
val remove : t -> Id.t -> unitremove h id removes the element with id from the heap, or leaves h unchanged if id is not present in h.
remove_predicate f h removes the elements elt for which f elt = true from the heap and returns the list of ids removed.
val clear : t -> unitclear h deletes all data from the heap.
module Internal_for_tests : sig ... end