![]() |
mutable
A Database System for Research and Fast Prototyping
|
Enumerate all subsets of size k
based on superset of size n
.
More...
#include <ADT.hpp>
Public Member Functions | |
GospersHack & | operator++ () |
Advance to the next subset. | |
operator bool () const | |
Returns false iff all subsets have been enumerated. | |
SmallBitset | operator* () const |
Returns the current subset. | |
Static Public Member Functions | |
static GospersHack | enumerate_all (uint64_t k, uint64_t n) |
Create an instance of GospersHack that enumerates all subsets of size k of a set of n elements. | |
static GospersHack | enumerate_from (SmallBitset set, uint64_t n) |
Create an instance of GospersHack that enumerates all remaining subsets of a set of n elements, starting at subset set . | |
Private Member Functions | |
GospersHack () | |
Private Attributes | |
SmallBitset | set_ |
uint64_t | limit_ |
Enumerate all subsets of size k
based on superset of size n
.
See http://programmingforinsomniacs.blogspot.com/2018/03/gospers-hack-explained.html.
|
inlinestatic |
Create an instance of GospersHack
that enumerates all subsets of size k
of a set of n
elements.
Definition at line 839 of file ADT.hpp.
References m::SmallBitset::All(), limit_, M_insist, and set_.
Referenced by DPsize::operator()(), DPsizeOpt::operator()(), and DPsizeSub::operator()().
|
inlinestatic |
Create an instance of GospersHack
that enumerates all remaining subsets of a set of n
elements, starting at subset set
.
Definition at line 849 of file ADT.hpp.
References limit_, M_insist, and set_.
Referenced by DPsizeOpt::operator()().
|
inline |
|
inline |
|
inline |
|
private |
Definition at line 833 of file ADT.hpp.
Referenced by enumerate_all(), enumerate_from(), and operator bool().
|
private |
Definition at line 832 of file ADT.hpp.
Referenced by enumerate_all(), enumerate_from(), operator bool(), operator*(), and operator++().