package grenier
A collection of various algorithms in OCaml.
Install
Dune Dependency
Authors
Maintainers
Sources
grenier-0.7.tbz
sha256=c2ab40ae80bce5e48f940925dc594f0886c1e54281ed32f28902bea3a3fe5de9
md5=fea64f9534b5a99df7d53665692af0be
doc/grenier.orderme/Order_managed/index.html
Module Order_managed
Basic ordering operations
val root : unit -> t
Create a new ordering with a single element. O(1)
after t
inserts a new element to the ordering, greater than t
but less than all existing elements greater than t
.
O(1) amortized.
before t
inserts a new element to the ordering, less than t
but greater than all existing elements less than t
.
O(1) amortized.
val cardinal : t -> int
How many elements are ordered. O(1)
Memory management
val forget : t -> unit
When you know you are not going to use an element any longer, forget
it to release memory. It makes operations slightly faster to not have to wait for the GC to release elements.
val is_valid : t -> bool
After calling forget
, an element should not be used. You can check if it is the case with is_valid
.
Algorithm due to: Two Simplified Algorithms for Maintaining Order in a List Bender et al., 2002
val unsafe_check : t -> string -> unit
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page