baseballgem
Programmer
I have the probelm of trying to get all the permuations of a string up to 9 characters.
EX) if its' "123" the result would be 3 factorial possibilities or 6.
123,132,231,213,321,312
For 8 "12345678" there are 8 factorial possibilities
I solved the problwm with arrays, for 8 factorial is 40320.
However, 9 factorial is 362880 too many elements for an array (program bombs).
Someone said just make a table for that case.
Oh well I suppose I couold; but I also recall seeing a long time ago (in BASIC) a very tight function that did this
using recursive calls.
My program is over 75 lines so I'm sure there's got to be a tighter cleaner way to do this.
Is anyone familiar with recursive calls or complete permutations of a string.
EX) if its' "123" the result would be 3 factorial possibilities or 6.
123,132,231,213,321,312
For 8 "12345678" there are 8 factorial possibilities
I solved the problwm with arrays, for 8 factorial is 40320.
However, 9 factorial is 362880 too many elements for an array (program bombs).
Someone said just make a table for that case.
Oh well I suppose I couold; but I also recall seeing a long time ago (in BASIC) a very tight function that did this
using recursive calls.
My program is over 75 lines so I'm sure there's got to be a tighter cleaner way to do this.
Is anyone familiar with recursive calls or complete permutations of a string.