TOMS452
Combinations of M things out of N


TOMS452 is a FORTRAN77 library 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: http://www.acm.org/pubs/calgo or NETLIB: http://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.

Languages:

TOMS452 is available in a FORTRAN77 version.

Related Programs:

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:

Examples and Tests:

List of Routines:

You can go up one level to the FORTRAN77 source codes.


Last revised on 01 December 2005.