in reply to OT: How to find anagrams?

You could further restrict the search to only words that contain those and only those letters. Thats a fairly quick regex with a character class and you've significantly reduced your word sets. MySQL (if you have your database in that) will even let you use regex in a query although i don't know if that will be faster or slower than doing them on your end.

I had a program once that took a set of rules and found all words that matched them, it could normaly be done in a single SQL statment but adding a temporary table saved a lot of time and shoehorning. :)

What is your source of words?


___________
Eric Hodges

Replies are listed 'Best First'.
Re: Re: OT: How to find anagrams?
by MidLifeXis (Monsignor) on Apr 28, 2004 at 18:07 UTC

    You could generate an SQL statement (on other DBs) such as...

    SELECT word FROM words WHERE length(word) = N AND word like '%A%A%' (if there are 2 'A' in the orig) AND word like '%B%' (if there is 1 'B' in the orig) ... ...
    to get all of your candidates.

    Of course, this assumes that your word list is in a DB.