|
ADS
Algorithms and Data Structures
|
The aggregate of a sliding window, beyond the book: a QUEUE of values of the monoid G [see Algebra.h] with aggregate(), the combination \( x_1 \oplus \cdots \oplus x_n \) of its values from the front to the back, in \( O( 1 ) \) time per operation, by the algorithm that the algebra and the policy allow (see The aggregate of a sliding window): More...
#include "ADS/Algebra.h"#include "ADS/Contract.h"#include "ADS/Portable.h"#include <algorithm>#include <concepts>#include <cstddef>#include <cstdint>#include <deque>#include <memory>#include <type_traits>#include <utility>#include <vector>#include "ADS/queue/impl/SlidingAggregate.tpp"Go to the source code of this file.
Classes | |
| struct | ADS::Amortized |
| the policy of a sliding window whose operations cost \( O( 1 ) \) amortized time, by the algorithm that suits the algebra More... | |
| struct | ADS::WorstCase |
| the policy of a sliding window whose operations cost \( O( 1 ) \) time in the worst case More... | |
| class | ADS::SlidingAggregate< G, Policy > |
| a QUEUE of values of the monoid G with the aggregate of its values, each operation in \( O( 1 ) \) time, amortized or in the worst case by Policy More... | |
Namespaces | |
| namespace | ADS |
Enumerations | |
| enum class | ADS::window_kind { ADS::window_kind::subtract_on_evict , ADS::window_kind::monotone_deque , ADS::window_kind::two_stacks , ADS::window_kind::real_time } |
| the algorithm of a sliding window [see SlidingAggregate] More... | |
The aggregate of a sliding window, beyond the book: a QUEUE of values of the monoid G [see Algebra.h] with aggregate(), the combination \( x_1 \oplus \cdots \oplus x_n \) of its values from the front to the back, in \( O( 1 ) \) time per operation, by the algorithm that the algebra and the policy allow (see The aggregate of a sliding window):
kind tells which one was chosen. MinQueue< T > and RealTimeMinQueue< T > [see MinQueue.h, RealTimeMinQueue.h] compute what SlidingAggregate< MinOf< T > > and SlidingAggregate< MinOf< T > , WorstCase > do, and stay as they are, since they also take an order that is an object rather than a type and give the least item by reference.
The contracts [see Contract.h]: top() and dequeue() need a window that is not empty; enqueue() ensures one item more, dequeue() one less. The operations are defined in SlidingAggregate.tpp.