# A Simple Systolic Algorithm for Generating Combinations in Lexicographic Order

• I .
• Published 1992

#### Abstract

-A systolic algorithm is described for generating, in lexicographlcally ascending order, all combinations of m objects chosen from {1 . . . . ,n). The algorithm is designed to he executed on a linear array of m processors, each having constant size memory, and each being responsible for producing one dement of a given combination. There is a constant delay per combination, leading to an O(C(m, n)) time solution, where C(m, n) is the total number of combinations. The algorithm is cost optimal (assttmlnwf the time to output the combinations is counted), does not deal with very large integers, and is much simpler than the previously known solutions that enjoy same properties. 1. I N T R O D U C T I O N In this paper, we investigate generating the C(m, n) combinations of m objects chosen from the set {1, 2 , . . . , n}, in lexicographically ascending order. We call these combinations (m, n)combinations. Various sequential algorithms have been given for this problem [1-8]. Comparisons of cornbination generation techniques are given in [9-10]. Note that, since each of the C(m, n) = n!/(m!(n m)!) combinations requires O(m) time to be produced as output, the best possible sequential algorithm runs in O(mC(m, n)) time (this is valid if the time to output combinations is taken into account; otherwise there are algorithms for generating combinations without producing them as output , whose running time is O(C(m, n))). Recently, the fast generation of combinations in parallel has been studied in the literature [11-18]. The algorithms in [15-18] satisfy the following criteria: (1) The combinations are listed in lexicographic order, i.e., ff A = (al , a2,. . . , am) and B = (bl,b2,. . . , bin) are two objects, then A precedes B lexicographically, ff and only if, for some j _) 1, ai -bi when i < j , and aj < bj. (2) The algorithm is cost-optimal, i.e., the number of processors it uses multiplied by its running time matches up to a constant factor a lower bound on the number of operations required to solve the problem. (3) The time required by the algorithm between any two consecutive objects it produces is constant. A constant time delay between outputs is particularly important in applications where the output of one computation serves as input to another. (4) The model of parallel computation should be as simple as possible. Arguably, the simplest such model is a linear array of ra processors, indexed 1 through m, where each processor i (1 < i < m) is connected by bidirectional links to its immediate left and right neighbors, i 1 and i + 1 (if exist). This model is practical, as it is amenable to VLSI implementation [14]. The linear array operates in systolic fashion: all processors execute the same algorithm simultaneously, with each processor passing data to neighboring ones in a regular rythmic pattern. This research is supported by the Natural Science and Engineering Research Council of Canada. Typeset by ,AA~-TEX 61

### Cite this paper

@inproceedings{1992ASS, title={A Simple Systolic Algorithm for Generating Combinations in Lexicographic Order}, author={I .}, year={1992} }