|
-
July 20th, 2009, 05:15 PM
#1
String Combinations
Hey All,
I'm working on a "scrabble cheat program" ( :P ) and while I'm aware of the next_permutation function, what I really need is a "next_combination" function. Does anyone know if there is an opensource one somewhere(i tried googling) or one hidden in the standard library?
Basically, I want a function that has input/output like this
input: ABA
Output:
AAB
ABA
BAA
AA
AB
BA
BB
A
B
input: ABC
ABC
ACB
BCA
BAC
CBA
CAB
AB
AC
BA
CA
CB
BC
A
B
C
String will be unknown length.
I tried using recursion, but that made my head hurt pretty bad.
Please and Thankyou,
Johnny
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|