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.
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.
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......
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'.