Functor CCHeap.Make

module Make (E : PARTIAL_ORD: S  with type elt = E.t
Parameters:
E : PARTIAL_ORD

type elt 
type t 
val empty : t
Empty heap
val is_empty : t -> bool
Is the heap empty?
exception Empty
val merge : t -> t -> t
Merge two heaps
val insert : elt -> t -> t
Insert a value in the heap
val add : t -> elt -> t
Synonym to CCHeap.S.insert
val filter : (elt -> bool) -> t -> t
Filter values, only retaining the ones that satisfy the predicate. Linear time at least.
val find_min : t -> elt option
Find minimal element
val find_min_exn : t -> elt
Same as CCHeap.S.find_min but can fail
Raises Empty if the heap is empty
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 take_exn : t -> t * elt
Same as CCHeap.S.take, but can fail.
Raises Empty if the heap is empty
val iter : (elt -> unit) -> t -> unit
Iterate on elements
val fold : ('a -> elt -> 'a) -> 'a -> t -> 'a
Fold on all values
val size : t -> int
Number of elements (linear complexity)

Conversions

The interface of of_gen, of_seq, of_klist has changed

val to_list : t -> elt list
Return the elements of the heap, in no particular order.
val to_list_sorted : t -> elt list
Return the elements in increasing order
Since 1.1
val add_list : t -> elt list -> t
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
val of_list : elt list -> t
of_list l = add_list empty l
val add_seq : t -> elt CCHeap.sequence -> t
Since 0.16

Similar to CCHeap.S.add_list
val of_seq : elt CCHeap.sequence -> t
val to_seq : t -> elt CCHeap.sequence
val to_seq_sorted : t -> elt CCHeap.sequence
Iterate on the elements, in increasing order
Since 1.1
val add_klist : t -> elt CCHeap.klist -> t
Since 0.16
val of_klist : elt CCHeap.klist -> t
val to_klist : t -> elt CCHeap.klist
val add_gen : t -> elt CCHeap.gen -> t
Since 0.16
val of_gen : elt CCHeap.gen -> t
val to_gen : t -> elt CCHeap.gen
val to_tree : t -> elt CCHeap.ktree
val print : ?sep:string -> elt CCHeap.printer -> t CCHeap.printer
Since 0.16