104#ifndef __ADS_RandomSampling
105 #define __ADS_RandomSampling
124#include <unordered_set>
207 std::size_t * rounds =
nullptr );
239 std::size_t * randoms =
nullptr );
263template<
class T ,
class R >
264std::vector< T >
heapSampling(
const std::vector< T > & S , std::size_t n ,
286template< std::input_iterator I , std::sentinel_for< I > S ,
class R >
299#include "ADS/numeric/impl/RandomSampling.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
A -ary heap of plain items, beyond the book: the heap of section 10.1 with children per node in a ve...
Insertion Sort (section 2.7.2), as one sorts a hand of cards: is inserted in the sorted prefix ,...
Random numbers as Knuth treats them (chapter 3 of The Art of Computer Programming),...
std::vector< std::size_t > sampleByDictionary(std::size_t n, std::size_t N, R &g)
of the positions , sorted, by a hash table of those drawn
std::vector< std::iter_value_t< I > > reservoirSampleL(I first, S last, std::size_t n, R &g)
items of , a stream of unknown length, by the skips of Algorithm L, in no particular order; all of th...
std::vector< T > heapSampling(const std::vector< T > &S, std::size_t n, R &g)
items of the stream , in the order of , by the largest of random keys, as if the length of were unk...
std::vector< std::size_t > sampleBySwaps(std::size_t n, std::size_t N, R &g)
of the positions , sorted, by swaps in an array of the positions
std::vector< std::size_t > sampleBySorting(std::size_t n, std::size_t N, R &g, std::size_t *rounds=nullptr)
of the positions , sorted, by a bucket sort of random positions; the rounds of draws go to *rounds,...
std::vector< std::size_t > sampleBySkips(std::size_t n, std::size_t N, R &g, std::size_t *randoms=nullptr)
of the positions , sorted, by the gaps of Vitter's Algorithm D (A when ); the random numbers drawn go...