vb.net - Link numbers with an equation/algorithm -


I am creating an Anagram Solver in Visual Basic which gives you all possible combinations when you put a string. I need to know how many combinations are given based on the number of characters in the string and the number of different characters.

EG

sample string:

ABC, ACB, BAC, BCA, taxi, ABC, CAB

I need the equation (using numbers and numbers of different characters) so that it can be linked in a string that contains different characters I am trying to use trial and error And the figure has ended, but I can not get enough of my head around it. I have so far:

((letters -1) ^ (different letters - 1)) + (letters-1)

which Works for one to calculate some different letters, but for all now.

Please help

I inspire you to answer, but I I will try to explain the way. Suppose you have 10 different characters, you have 10 options for the first, 9 for the second, 8 for the third, etc. Finally, 10 * 9 * 8 * 7 * 6 ... * 2 * 1 = 10! Possibilities However, sometimes you will have several examples of the same letter. For example, the probability of using the string "AAABCD" increases, since it is counted as different letters of each, although they are not, to correct it, you have to repeat the number of letters Departmental Division on the basis of It would be a good way to calculate the total number of possibilities (the number of total letters white) / (the product of the facts of the number of repetitive examples of each letter).

For example: 6 are! / (3!) "AABD" ways to organize letters are 6! Methods of organizing letters are "abcdef" - 6! / (3! * 2!) "Aaabak" are ways to organize letters! There 10! / (5! * 3! * 2!) Ways to Organize Letters in "AABBACKS"

I hope that it will be helpful.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -