-
containers
-
containers.data
-
containers.monomorphic
-
containers.sexp
-
containers.top
Library
Module
Module type
Parameter
Class
Class type
val empty : t
Empty heap.
val is_empty : t -> bool
Is the heap empty?
Filter values, only retaining the ones that satisfy the predicate. Linear time at least.
Extract and return the minimum element, and the new heap (without this element), or None
if the heap is empty.
Delete one occurrence of a value if it exist in the heap. delete_one eq x h
, use eq
to find one x
in h
and delete it. If h
do not contain x
then it return h
.
- since 2.0
Delete all occurrences of a value in the heap. delete_all eq x h
, use eq
to find all x
in h
and delete them. If h
do not contain x
then it return h
. The difference with filter
is that delete_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
).
Add the elements of the list to the heap. An element occurring several times will be added that many times to the heap.
- since 0.16