/** Basic combinatorial utility. For internal use only. */ import { Primitive } from "./util"; /** * Return all k-combinations with repition from a given pool. * * For example if the pool is the array [1, 2, 3, 4] and k = 2 the result are * all multi-subarrays of length 2: * * [1,1], [2,1], [3,1], [4,1], [2,2], [3,2], [4,2], [3,3], [4,3], [4,4]. * * The elements are ordered lexicographically. * * Remark: If n is the length of the iterable, there are n+k-1 over k such * combinations. * * See also: * https://en.wikipedia.org/wiki/Combination#Number_of_combinations_with_repetition * * @param pool A finite sequence * @param k The length of the combinations: 1, 2, 3, ... */ export declare function combinationsWithRepitition(pool: readonly T[], k: number): T[][]; /** * Return all k-combinations from a given sequence. * * For example if the pool is the array [1,2,3,4] and k = 2 the result are all * subsequences of length 2: * * [1,2], [1,3], [1,4], [2,3], [2,4], [3,4]. * * The ordering is given as follows: Start with the k-combination with minimal * indices (here [1,2]), then repeat the following: Generate the next * combination by selecting the right-most index which can be incremented by 1 * without making the new combination invalid (and do that), until this is * impossible (then all possible k-combinations are visited). * * Throws in case k > length of iterable * * Remark: If n is the length of iterable, the number of generated * k-combinations is given by the binomal coefficient n over k. * * See also: * https://en.wikipedia.org/wiki/Combination#Enumerating_k-combinations * * @param pool A finite sequence * @param k The length of the combinations: 1, 2, 3, ... */ export declare function combinations(pool: readonly T[], k: number): T[][];