Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef COMBINATION_GENERATOR_H
- #define COMBINATION_GENERATOR_H
- #ifdef WIN32
- #pragma once
- #endif
- #define NULL nullptr
- #include <vector>
- class CombinationGenerator {
- public:
- CombinationGenerator() {}
- ~CombinationGenerator();
- void Initialize( int n, int k );
- void Initialize( int n, int k, unsigned long long numCombinations );
- std::vector<int> NextCombination();
- unsigned long long ComputeBinomialCoefficient( int n, int k );
- unsigned long long GetNumLeft();
- bool IsFinished();
- private:
- int n;
- int k;
- unsigned long long m_iNumCombinations;
- unsigned long long m_iNumLeft;
- std::vector<int> m_vecCurrCombination;
- }; extern CombinationGenerator* g_pCombinationGen; // You'll probably only want one of these running in your project, so we'll make a global pointer to it.
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement