I am looking for the best way of generating all strings permutations in a range.
Here is an example.
Start : aaaa
End : cccc
Or for example
Start : aabb
End : ccaa
Strings that should be generated for the first case
aaaa,aaab,aaac,aaba,aabb,aabc,aaca,aacb ... cccc
So I hope you got an idea. All possible permutations.
Please suggest how to solve this problem efficiently. I can write nested loops, but I hope there are some default implementations that are much more efficient.
EDIT
The same as counting in binary system
100
101
110
111
EXAMPLE
Start : aaa
End : ccc
aaa
aab
aac
aba
abb
abc
aca
acb
acc
baa
bab
bac
bba
bbb
bbc
bca
bcb
bcc
caa
cab
cac
cba
cbb
cbc
cca
ccb
ccc
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…