Module type CCHeap.S
val empty : tEmpty heap.
val is_empty : t -> boolIs the heap empty?
val filter : (elt -> bool) -> t -> tFilter values, only retaining the ones that satisfy the predicate. Linear time at least.
val take : t -> (t * elt) optionExtract and return the minimum element, and the new heap (without this element), or
Noneif the heap is empty.
val delete_one : (elt -> elt -> bool) -> elt -> t -> tDelete one occurrence of a value if it exist in the heap.
delete_one eq x h, useeqto find onexinhand delete it. Ifhdo not containxthen it returnh.- since
- 2.0
val delete_all : (elt -> elt -> bool) -> elt -> t -> tDelete all occurrences of a value in the heap.
delete_all eq x h, useeqto find allxinhand delete them. Ifhdo not containxthen it returnh. The difference withfilteris thatdelete_allstops as soon as it enters a subtree whose root is bigger than the element.- since
- 2.0
val size : t -> intNumber 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).
val add_list : t -> elt list -> tAdd 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
val add_seq : t -> elt sequence -> tval of_iter : elt iter -> tBuild a heap from a given
iter. Complexity:O(n log n).- since
- 2.8
val of_seq : elt sequence -> tval to_iter : t -> elt iterReturn a
iterof the elements of the heap.- since
- 2.8