Efficient word scramble algorithm

前端 未结 4 1701
情歌与酒
情歌与酒 2020-12-30 06:13

I\'m looking for an efficient algorithm for scrambling a set of letters into a permutation containing the maximum number of words.

For example, say I am given the li

4条回答
  •  长情又很酷
    2020-12-30 07:02

    Have you thought about using a genetic algorithm? You have the beginnings of your fitness function already. You could experiment with the mutation and crossover (thanks Nathan) algorithms to see which do the best job.

    Another option would be for your algorithm to build the smallest possible word from the input set, and then add one letter at a time so that the new word is also is or contains a new word. Start with a few different starting words for each input set and see where it leads.

    Just a few idle thoughts.

提交回复
热议问题