subset, a C code which enumerates, generates, randomizes, ranks and unranks combinatorial objects including combinations, compositions, Gray codes, index sets, partitions, permutations, polynomials, subsets, and Young tables. Backtracking routines are included to solve some combinatorial problems. Other routines handle continued fractions, Diophantine equations, and Pythagorean triples.

These include the enumeration, generation, random selection, ranking and unranking of

Other objects considered include


The information on this web page is distributed under the MIT license.


subset is available in a C version and a C++ version and a Fortran77 version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:


backtrack_binary_rc, a C code which carries out a backtrack search for a set of binary decisions, using reverse communication.

change_dynamic, a C code which considers the change making problem, in which a given sum is to be formed using coins of various denominations.

combo, a C code which contains many combinatorial routines.

knapsack_01_brute, a C code which uses brute force to solve small versions of the 0/1 knapsack problem;

legendre_product_polynomial, a C code which defines Legendre product polynomials, creating a multivariate polynomial as the product of univariate Legendre polynomials.

monomial, a C code which enumerates, lists, ranks, unranks and randomizes multivariate monomials in a space of M dimensions, with total degree less than N, equal to N, or lying within a given range.

polynomial, a C code which adds, multiplies, differentiates, evaluates and prints multivariate polynomials in a space of M dimensions.

set_theory, a C code which demonstrates various set theoretic operations using several models of a set.

toms515, a C code which can select subsets of size K from a set of size N. This is a version of ACM TOMS Algorithm 515, by Bill Buckles, Matthew Lybanon.

ubvec, a C code which demonstrates how unsigned binary vectors, strings of 0's and 1's, can represent nonnegative integers or subsets or other mathematical objects, for which various arithmetic and logical operations can be defined.

Source Code:

Last revised on 11 August 2019.