c# - Creating Set of sequnces(12345678) -
i create set of strings , below limitation. same digit should not repeat.
string range 1-8(12345678) or 1-16(12345678910111213141516)
example:(set of series)
12345678 12345687 12345876 12345867 ... ... 87654321 like 2^8(1-8) , 2^16(1-16) possibilities there. how can generate these strings efficiently less computation?
your 8 case possible run out of space after that.
this not 2^n case think -- it's n! case.
for 8, there 40,320 permutations.
permute(k,n) = k! / (n-k)! permute(8,8) = 8! / (8-8)! = 8! = 40320 for 16, there 20,922,789,888,000 permutations. @ 16 bytes / permutation, you'll need 304tb store them.
@kol's answer should permutations think need change requirements.
Comments
Post a Comment