snippets 0.1.0
Loading...
Searching...
No Matches
hsc_snippets::SegmentTree< T > Class Template Reference

#include <segment_tree.hpp>

Public Member Functions

 SegmentTree (const std::vector< T > &a)
 
range_sum (int left, int right)
 
void range_set (int left, int right, T value)
 
void range_add (int left, int right, T value)
 
int size () const
 

Constructor & Destructor Documentation

◆ SegmentTree()

template<std::integral T>
hsc_snippets::SegmentTree< T >::SegmentTree ( const std::vector< T > & a)
inlineexplicit

Member Function Documentation

◆ range_add()

template<std::integral T>
void hsc_snippets::SegmentTree< T >::range_add ( int left,
int right,
T value )
inline

Add value to all elements in the range [left, right].

Parameters
left0-indexed, inclusive
right0-indexed, inclusive
valueThe value to add for each element within the specified range

◆ range_set()

template<std::integral T>
void hsc_snippets::SegmentTree< T >::range_set ( int left,
int right,
T value )
inline

Assign value to all elements in the range [left, right].

Parameters
left0-indexed, inclusive
right0-indexed, inclusive
valueThe value to set for each element within the specified range

◆ range_sum()

template<std::integral T>
T hsc_snippets::SegmentTree< T >::range_sum ( int left,
int right )
inline

Compute the sum of values within the range [left, right].

Parameters
left0-indexed, inclusive
right0-indexed, inclusive

◆ size()

template<std::integral T>
int hsc_snippets::SegmentTree< T >::size ( ) const
inline

Return the size of the original vector.


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