# Find all the permutations given some finite characters

1. Oct 5, 2012

### jd12345

Well I am coming across problems like finding permutation of some n characters. On paper I can find all the permutations given some finite characters easily but when it comes to programming it is hard, why? Why is it hard to tell a computer what I myself can do it so easily?
This is strange - I mean I can do it myself so easily but I can't code it. Does this mean that I myself don't understand it?

2. Oct 5, 2012

### rcgldr

Re: I can do it but dont know how

The issue is that you need an algorithm to do the permuations in some specific order, without duplicates. A recursive method may be useful here. You could to a web search for "permuting an array", and find examples of code that does this, or you could grind it out. The two main operations are swapping and rotating of the characters.

3. Oct 5, 2012

### gsal

Re: I can do it but dont know how

doing it without thinking is not quite enough, is it?

You need to do it once or twice and develop a set of steps, instructions that work every time and writ them down as if you were to give them to somebody else who does not how to do such thing and they should be able to follow your instructions and do it...

...then, you can give them to a computer...after all, computers are very stupid...they just do what you tell them to do!

4. Oct 8, 2012

### jd12345

Re: I can do it but dont know how

if i cannot explain it to someone then how am i able to do it ?

5. Oct 9, 2012

### Jocko Homo

Maybe...

Are you sure you can do it yourself? For how long a string have you tried to find all the permutations of? How do you know you've successfully found all permutations?

How well do you know how to program? If you don't know how to program sufficiently well then obviously you won't necessarily be able to program what you know how to do...

Can you even describe in English how to enumerate over all permutations?