package orsetto

  1. Overview
  2. Docs
A library of assorted structured data interchange languages

Install

Dune Dependency

Authors

Maintainers

Sources

r1.1.3.tar.gz
sha512=9b654edb663ae697563f150824047052f3b1bf760398f24bce6350553f031f73c46b6337239a1acd871e61238597ea92046809e3358290ff14d6ba671b449085

doc/orsetto.cf/Cf_sbheap/Heap/Create/index.html

Module Heap.Create

A functor to create a Heap module.

Parameters

Signature

type t

The heap type.

val nil : t

The empty heap.

val one : E.t -> t

Use one e to create a heap containing the single element e.

val empty : t -> bool

Use empty h to test whether h is empty.

val size : t -> int

Use size h to compute the number of elements in h. Runs in O(n) time and O(log N) space.

val head : t -> E.t

Use head h to obtain the element on the top of the heap h. Raises Not_found if the heap is empty.

val tail : t -> t

Use tail h to obtain the heap produced by discarding the element at the top of h. If h is the empty heap, then the empty heap is returned.

val pop : t -> (E.t * t) option

Use pop h to obtain the head and the tail of a heap h in one operation. Returns None if the h is empty.

val put : E.t -> t -> t

Use put e h to obtain a new heap that is the result of inserting the element e into the heap h.

val merge : t -> t -> t

Use merge h1 h2 to obtain a new heap that is the result of merging all the elements of h1 and h2 into a single heap.

val of_seq : E.t Seq.t -> t

Use of_seq s to construct a heap from a sequence of elements. Evaluates the whole sequence. Runs in O(n) time and O(1) space.

val to_seq : t -> E.t Seq.t

Use to_seq h to produce a sequence of the elements in h from top to bottom.

OCaml

Innovation. Community. Security.