lichao 0.1.1

Li-Chao tree implementation ported from the authors competitive programming library
Documentation
  • Coverage
  • 50%
    5 out of 10 items documented0 out of 7 items with examples
  • Size
  • Source code size: 17.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 375.71 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • isogenist/LiChao
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • isogenist

lichao

Implementation of a Li-Chao tree ported from the authors competitive programming library.

Theoretically, a Li-Chao tree should support any function which has the transcending property, but this implementation supports only lines, which are the most common use case.

Currently doesn't support adding custom-width line segments, will be added soon.

Since the performance of Li-Chao trees depends on the size of the domain, it may be preferable to use the Convex hull trick instead.

Li-Chao trees

Li-Chao trees solve the following problem class in O(log n) time:

Given a set S of functions s.t. each pair of functions can intersect at most one point (e.g. lines), efficiently implement
1. Adding a function to S
2. Answering the minimum/maximum value at f(t) for all functions f in S (i.e. \min{f \in S} f(t))

Formally, we require the functions to have the transcending property, that is, given two functions $f, g \in S$, if $f(t) = g(t)$, then either $f(x) < g(x) \forall x < t$ and $f(x) > g(x) \forall x > t$, or $f(x) > g(x) \forall x < t$ and $f(x) < g(x) \forall x > t$