A new algorithm for generating combinations

Xun Luo · Journal of Hefei University of Technology · 2011

A new algorithm for generating all the combinations of {1,2,…,n} is proposed in this paper,which is simple in procedure and elementary in theory.In light of the one-to-one correspondence of combinations of {1,2,…,n}with n-digit binary numbers,starting with the n-digit binary number of 00…0,this algorithm generates the n-digit binary numbers one by one,until the last n-digit binary number of 11…1 is obtained.The result of the algorithm is a list,containing each of n-digit binary numbers which occur only once.Rather than having to retain a list of all the n-digit binary numbers,the presented algorithm overwrites the current n-digit binary number with succeeding one,and it is cyclical.

Read the paper · More papers on PaperTik