Generating All k-Subsets of \(\{1 \ldots n\}\) with Minimal Changes

T.A. Jenkyns1,2
1 Department of Mathematics D. McCarthy, Dept. of Computer Science
2 Brock University St. Catharines, Ontario Canada L2S 3A1

Abstract

An algorithm is given to generate all \(k\)-subsets of \(\{1, \ldots, n\}\) as increasing sequences, in an order so that going from one sequence to the next, exactly one entry is changed by at most \(2\).