Campbell Ritchie wrote:Welcome to the Ranch
Please show us what you have got so far. What algorithm are you using to find the permutations and combinations?
Piet Souris wrote:Haven't looked at your code, but a method that spawns all permutations of a Collection is always useful. Note that there are n! permutations, if the Collection has size n (if there are no duplicates in that Collection).
However, knowledge of all permutations is not necessary in this case.
Lets say that our given word is "TCA". If we sort the characters, then we get "ACT". Note that "ACT" is a permutation of "TCA". Now suppose our list contains the word "CAT". Since it has the same number of characters as our key, "CAT" might be a candidate. If we sort the characters, we get "ACT". Hey, that is equal to our sorted key, meaning that "ACT" and "CAT" are permutations (or anagrams)! What now?
Jesse Silverman wrote:I noticed a Freudian Slip in Piet's GUI
Jesse Silverman wrote:, but mostly wanted to say: (...)
Nathan Delsein wrote:Next step, how can I find the original words? For instance: the program returns "abc" for "bac" (a french word), but how can I order the letters back to their original position to give me the real word?
Nathan Delsein wrote:I MADE IT !!! Thanks a lot!
Carey Brown wrote:It would be of help to others with similar problems if you would post your solution(s) back here.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton