toms452


toms452, a Fortran77 code which implements ACM toms algorithm 452, for generating, one at a time, the combinations of M things out of N.

The text of many ACM TOMS algorithms is available online through ACM: https://www.acm.org/pubs/calgo or NETLIB: https://www.netlib.org/toms/index.html.

Usage:

call nxcbn ( n, m, ic )
where N is the total number of things, M is the number of things in the combination, and IC(1:N) contains exactly M values of 1, with the rest being 0. On output, IC will be altered to indicate the "next" combination.

Licensing:

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

Languages:

toms452 is available in a Fortran77 version.

Related Programs:

toms452_test

combo, a Fortran90 library which contains several routines for generating, ranking, or randomly selecting a combination.

SUBSET, a Fortran90 library which contains many routines for generating, ranking, or randomly selecting a combination.

Reference:

  1. CN Liu, DT Tang,
    Algorithm 452: Enumerating Combinations of M out of N Objects,
    Communications of the ACM,
    August 1973, Volume 16, Number 8, page 485.

Source Code:


Last revised on 01 December 2005.