Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[delphi] generating binary strings

Name: Anonymous 2012-01-19 18:10

How can I generate all binary strings of n length with m ones? (in delphi)
sample: n=3 m=2:
110
101
011

Name: >>26 2012-01-20 18:20

This just generates all permutations of a vector then takes the nub of that.

(i.x)           0 1 2 3 ... x-1
(i.x)<y         1 1 ... 1 (y times) 0 0 ... 0 (x times)
(i.!x)          0 1 2 3 ... fact(x)-1
a A. b          a'th permutation of b
~. a            nub of elements

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List