Module CCHeap.Make
Parameters
E : PARTIAL_ORD
Signature
type elt
= E.t
type t
val empty : t
Empty heap.
val is_empty : t -> bool
Is the heap empty?
val filter : (elt -> bool) -> t -> t
Filter values, only retaining the ones that satisfy the predicate. Linear time at least.
val take : t -> (t * elt) option
Extract and return the minimum element, and the new heap (without this element), or
None
if the heap is empty.
val delete_one : (elt -> elt -> bool) -> elt -> t -> t
Delete one occurrence of a value if it exist in the heap.
delete_one eq x h
, useeq
to find onex
inh
and delete it. Ifh
do not containx
then it returnh
.- since
- 2.0
val delete_all : (elt -> elt -> bool) -> elt -> t -> t
Delete all occurrences of a value in the heap.
delete_all eq x h
, useeq
to find allx
inh
and delete them. Ifh
do not containx
then it returnh
. The difference withfilter
is thatdelete_all
stops as soon as it enters a subtree whose root is bigger than the element.- since
- 2.0
val size : t -> int
Number of elements (linear complexity).
Conversions
The interface of of_gen
, of_seq
, of_klist
has changed since 0.16 (the old signatures are now add_seq
, add_gen
, add_klist
).