Assignment Search Framework
|
Functions | |
bool | get_next_combo_helper (vector< unsigned > &combo, unsigned max_num, unsigned pos, bool reset_rest) |
bool | get_next_combo (vector< unsigned > &combo, unsigned k, unsigned n, bool first_combo) |
void | get_rand_permutation (vector< unsigned > &perm, unsigned perm_size) |
uint64_t | get_64_bit_factorial (unsigned n) |
uint64_t | get64BitnUpperk (unsigned n, unsigned k) |
bool | read_in_permutations (string file_name, vector< vector< unsigned > > &perms) |
uint64_t get64BitnUpperk | ( | unsigned | n, |
unsigned | k | ||
) |
Returns the value of n!/k! for the given integers.
No guarantees on what happens if there is an overflow.
n | The denominator of the n!/k! term. |
k | The numerator of the n!/k! term. |
uint64_t get_64_bit_factorial | ( | unsigned | n | ) |
Returns n! for the given value of n.
If n is too large, it just returns the highest value stored in 64 bits.
n | The value to take the factorial of. |
bool get_next_combo | ( | vector< unsigned > & | combo, |
unsigned | k, | ||
unsigned | n, | ||
bool | first_combo | ||
) |
bool get_next_combo_helper | ( | vector< unsigned > & | combo, |
unsigned | max_num, | ||
unsigned | pos, | ||
bool | reset_rest | ||
) |
Helper function for get_next combo.
Given a combination, a position, and whether we are at a reset, finds the next combo if one exists. This means incrementing the element at the given position if possible, and then resetting the remaining values to the smallest values left. If its not possible, it returns false.
combo | The current combo which is updated to get the next combo. |
max_num | The maximum element value. |
pos | The current position. |
reset_rest | Whether the combo should be reset starting from the given position. |
void get_rand_permutation | ( | vector< unsigned > & | perm, |
unsigned | perm_size | ||
) |
bool read_in_permutations | ( | string | file_name, |
vector< vector< unsigned > > & | perms | ||
) |