Combinations Generator
Generate all k-sized combinations of a list in deterministic lexicographic order.
Description
Generate every size-k combination of a numeric list without changing the order of selected positions.
The combinations generator selects k positions from a list without regard to alternative selection order. It is useful for small exhaustive searches, committee or feature subsets, and checking combinatorial examples where each source position may be used at most once.
When to use Combinations Generator
- Enumerate every k-item subset for a small search
- Inspect binomial-coefficient examples
- Choose groups while preserving their source order
How the calculation works
A depth-first backtracking search chooses increasing source indices. This prevents the same position from being selected twice and avoids producing separate orderings of the same selection. A size of zero returns the single empty combination, consistent with the standard combinatorial convention.
Interpreting the result
Each row contains one selection, and the rows follow deterministic source-index order. Duplicate input values can produce visually identical rows because positions—not unique numeric values—are selected.
Important limitations
- Combination count grows as n choose k and can become large quickly.
- The tool does not deduplicate equal-valued rows produced by repeated inputs.
- Selection order is not permuted; use the permutations generator when order matters.