Find all the permutations given some finite characters

AI Thread Summary
Finding permutations of a set of characters can be straightforward on paper but challenging in programming due to the need for a clear algorithm. The discussion highlights that while individuals may intuitively grasp the concept of permutations, translating that understanding into code requires structured thinking and the ability to articulate the process clearly. Key methods include using recursion and understanding operations like swapping and rotating characters. It emphasizes the importance of developing a step-by-step approach that can be communicated effectively, as computers require precise instructions to execute tasks. The conversation also raises questions about one's programming proficiency and the ability to describe the permutation process in clear terms, suggesting that a deeper understanding of both the concept and coding is necessary for successful implementation.
jd12345
Messages
251
Reaction score
2
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?
 
Technology news on Phys.org


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.
 


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!
 


if i cannot explain it to someone then how am i able to do it ?
 
jd12345 said:
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?
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?
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top