gingerfish
Programmer
Hi,
I have a question of how to tackle following task:
A string/word, e.g. ‘ABC’, needs to be displayed with all its permutations.
So from ‘ABC’ it would get me
‘ABC’, ‘ACB’, ‘BAC’, BCA’, ‘CAB’, CBA’.
What is the best way of doing that?
I was thinking of an array holding four variables, one for counting and three for A B C. But then I’m not quite sure about how the loop needs to be.
Any help is much appreciated.
Thanks a lot,
Gingerfish
I have a question of how to tackle following task:
A string/word, e.g. ‘ABC’, needs to be displayed with all its permutations.
So from ‘ABC’ it would get me
‘ABC’, ‘ACB’, ‘BAC’, BCA’, ‘CAB’, CBA’.
What is the best way of doing that?
I was thinking of an array holding four variables, one for counting and three for A B C. But then I’m not quite sure about how the loop needs to be.
Any help is much appreciated.
Thanks a lot,
Gingerfish