This program will take in any given amount of
numbers and/or letters, and will create every possible combination with
those. The letters or numbers have to be inputted one after the other.
If you want to see all possible combinations of the word "dreamweaver",
you would have to enter it as is displayed in between the quotation
marks. Please note that the number of possibilities of writing any
given string will be the length of that string factorial. If we take
the string "printer", we see that there are 7 letters. n = 7. n! = 7! =
5040. That is the amount of possibilities for this word. That is the
case because there are no duplicate letters or numbers. If we take the
word "hello". Here, n = 5, so n! = 5! = 120 would be a good answer? No,
we cannot, because the "l" is a duplicate. We must divide the the
amount of duplicates factorial to eliminate this. Hence, 120/2! = 60,
which represents the possibilities. This program was designed by my friend and I, and coded by my friend. The program was coded in python, and the source has since then been lost. The algorithm went as follows: Basically, lets say you have an word of length m. It suffices to put each letter of the word in an array of length m. Then, you use the m spaces as counting numbers, and count up to the number represented by an array full of integer ms. You must skip any digit p > m - 1 while doing the counting. Here is an example: For the word camera, there are 6 letters. m=6. What we must do is setup an array of length 6. It will look like this:
You will then start a count from 000000 all the way to 666666. You will skip all digits bigger than 6. So, 567765 cannot be counted since the digit 7 is there, and the number 7 cannot be accessed in the array. Note too that as an index, only m - 1 can be accessed. This is associated with the convention of naming the indeces. The program is dowloadable below: You can download this via the attachments link below: |