All Possible Arrangements of a word

I want to make a program that prints all the possible arrangements of a given word.
As Input - abc
abc
bca
cab
acb
bac
cba
You've posted at least two other homework assignments here recently. Generally we aren't going to do your homework for you. But if you post your non-working code, we will help guide you in the right direction.
Only I want to know the algorithm then i'll try.
You've got it backwards. TRY, then post what you have and we will help you from there.
Yeah...it's like saying "I want to know what the answer to 2+2 is, then I will try adding!" That kind of logic is reserved for fools.
if u can't help don't give your suggestions
Ok, you pretty much guaranteed you won't get any help here. All of us frequent responders are more than capable of implementing your assignment in 10 minutes or less. But we aren't just going to give you the solution, because then we've wasted our time and you haven't learned anything.

then jsmith please tell me what should i do when i am interrupted in any program of this type..... many times it is possible that we think of algorithms but cannot implement in the programming.. please help me in increasing my programming skills.
If you are having trouble converting your algorithm into code, then please post your algorithm and we can go from there.
I think i can do this by following algo-
suppose i have word - abcdef
then i will fix _b_c_d_e_f_ and put 'a' in the place of _ in each step
as 1- 'a'bcdef 2- b'a'cdef 3- bc'a'def .......
in next step i will fix acdef and move b similarly.....

after that i will choose any 2 characters say 'ab' and move this in whole string cdef in both way 'ab' and 'ba'... in next step 3 characters .......... means the moving characters will also be involved in this algo......

i think it can be solved by recursion.
Yes, recursion will work for this program.

Two questions -
1) Are words fixed length or can they vary in length (up to a limit)?
2) How are you supposed to handle duplicate letters? For example,
there are 6 permutations of 'abc' but only 3 permutations of 'abb'.

yes i have problem with repeated letters. the length of the word may vary.
Topic archived. No new replies allowed.