Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Li_Chao_Tree< T > Class Template Reference

Li Chao tree for min line queries on an integral x-domain. More...

#include <DP_Optimizations.H>

Collaboration diagram for Aleph::Li_Chao_Tree< T >:
[legend]

Classes

struct  Line
 Affine line y = m*x + b. More...
 
struct  Node
 

Public Member Functions

 Li_Chao_Tree (const T x_left, const T x_right)
 
bool is_empty () const noexcept
 
size_t node_count () const noexcept
 
void clear ()
 
void add_line (const T slope, const T intercept)
 
T query (const T x) const
 

Private Member Functions

size_t new_node (const Line &line)
 
void add_line_impl (const size_t idx, const T l, const T r, Line line)
 
T query_impl (const size_t idx, const T l, const T r, const T x) const
 

Private Attributes

T x_left_
 
T x_right_
 
Array< Nodenodes_
 
size_t root_ = NIL
 

Static Private Attributes

static constexpr size_t NIL = std::numeric_limits<size_t>::max()
 

Detailed Description

template<typename T>
class Aleph::Li_Chao_Tree< T >

Li Chao tree for min line queries on an integral x-domain.

Supports arbitrary line insertion order and O(log X) min queries where X is the domain length.

Template Parameters
TSigned integral numeric type for coordinates.

Definition at line 529 of file DP_Optimizations.H.

Constructor & Destructor Documentation

◆ Li_Chao_Tree()

Member Function Documentation

◆ add_line()

◆ add_line_impl()

◆ clear()

◆ is_empty()

template<typename T >
bool Aleph::Li_Chao_Tree< T >::is_empty ( ) const
inlinenoexcept

◆ new_node()

template<typename T >
size_t Aleph::Li_Chao_Tree< T >::new_node ( const Line line)
inlineprivate

◆ node_count()

template<typename T >
size_t Aleph::Li_Chao_Tree< T >::node_count ( ) const
inlinenoexcept

Definition at line 629 of file DP_Optimizations.H.

References Aleph::Li_Chao_Tree< T >::nodes_.

◆ query()

◆ query_impl()

Member Data Documentation

◆ NIL

◆ nodes_

◆ root_

◆ x_left_

◆ x_right_


The documentation for this class was generated from the following file: