Debian Codegraph @

clib/segmenttree.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 (** This module is a very simple implementation of "segment trees".
12
13 A segment tree of type ['a t] represents a mapping from a union of
14 disjoint segments to some values of type 'a.
15 *)
16
17 (** A mapping from a union of disjoint segments to some values of type ['a]. *)
18 type 'a t
19
20 (** [make [(i1, j1), v1; (i2, j2), v2; ...]] creates a mapping that
21 associates to every integer [x] the value [v1] if [i1 <= x <= j1],
22 [v2] if [i2 <= x <= j2], and so one.
23 Precondition: the segments must be sorted. *)
24 val make : ((int * int) * 'a) list -> 'a t
25
26 (** [lookup k t] looks for an image for key [k] in the interval tree [t].
27 Raise [Not_found] if it fails. *)
28 val lookup : int -> 'a t -> 'a
29
30