Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Find all the permutations given some finite characters

  1. Oct 5, 2012 #1
    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. jcsd
  3. Oct 5, 2012 #2

    rcgldr

    User Avatar
    Homework Helper

    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.
     
  4. Oct 5, 2012 #3
    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!
     
  5. Oct 8, 2012 #4
    Re: I can do it but dont know how

    if i cannot explain it to someone then how am i able to do it ?
     
  6. Oct 9, 2012 #5
    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?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Find all the permutations given some finite characters
Loading...