package containers
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=18f35ec3794803f5a4f95254f313c764
sha512=090e33705ffb0f77f71f881f78b51d909778bf41afad32339acac21ddbd5f6947b4ebff754148331f9263a544a6000d7f7412d5758e1835fbe84490240b671de
doc/containers/CCHeap/Make_from_compare/index.html
Module CCHeap.Make_from_compareSource
A convenient version of Make that take a TOTAL_ORD instead of a partially ordered module. It allow to directly pass modules that implement compare without implementing leq explicitly
Parameters
Signature
filter p h filters values, only retaining the ones that satisfy the predicate p. Linear time at least.
take h extracts and returns the minimum element, and the new heap (without this element), or None if the heap h is empty.
delete_one eq x h uses eq to find one occurrence of a value x if it exist in the heap h, and delete it. If h do not contain x then it return h.
delete_all eq x h uses 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.
iter f h iterates over the heap h invoking f with the current element.
Conversions
to_list h returns the elements of the heap h, in no particular order.
to_list_sorted h returns the elements of the heap h in increasing order.
add_list h l adds the elements of the list l into the heap h. An element occurring several times will be added that many times to the heap.
add_seq h seq is like add_list. Renamed from add_std_seq since 3.0.
of_iter iter builds a heap from a given iter. Complexity: O(n log n).
of_seq seq builds a heap from a given Seq.t. Complexity: O(n log n). Renamed from of_seq since 3.0.
to_seq h returns a Seq.t of the elements of the heap h. Renamed from to_std_seq since 3.0.
to_iter_sorted h returns a iter by iterating on the elements of h, in increasing order.
to_seq_sorted h returns a Seq.t by iterating on the elements of h, in increasing order. Renamed from to_std_seq_sorted since 3.0.
to_string ?sep f h prints the heap h in a string using sep as a given separator (default ",") between each element (converted to a string using f).
val pp :
?pp_start:unit printer ->
?pp_stop:unit printer ->
?pp_sep:unit printer ->
elt printer ->
t printerpp ?pp_start ?pp_stop ?pp_sep ppf h prints h on ppf. Each element is formatted with ppf, pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ "). Renamed from print since 2.0