InvestorsHub Logo
Followers 211
Posts 7903
Boards Moderated 15
Alias Born 05/24/2001

Re: cintrix post# 66557

Thursday, 05/11/2006 7:53:43 PM

Thursday, May 11, 2006 7:53:43 PM

Post# of 216929
If you're talking about the Anagram Solver, sorry to say I removed it about 2 or 3 years ago. Too bad because it was really cool!

I'd come up with what turned out to be the fastest algorithm around (from what I could find) for unscrambling single-word anagrams and, much to my amazement, it was our most frequently-hit page on the whole site for a while.

Finally determined why. Some site or sites were making calls to my program and parsing the results and returning them to their own users as their own content. Yep. Even with the back-and-forth and parsing, it was the fastest thing available.

I didn't mind the misappropriation of my work. I minded all the hits that didn't result in ad views.

I so DON'T mind the use of the algorithm, that I'll share it here in case anyone wants to use it. After I hit upon it, it seemed extremely obvious and I wondered why it didn't seem anyone else had hit upon it.

Warning: Geek-speak follows.

In your word list (in our case, a 250k-word dictionary), add an integer field, then write a program to run through the word list and sum the ascii values of the lower-case versions of each letter in each word into its integer field. Index the integer field.

When someone inputs a word, do the same ascii-summing of the lowercase of the letters they entered, and select all words of the same value in your dictionary. It's surprising how few words will typically be returned.

Then do the usual thing of sorting the characters of the input word in alpha order and doing the same with the result set, and look for a match and return each word that's a match.

Arguably, the same could be done by adding a field that stores the letters of the word in alpha order rather than an integer, but integers use a lot less room and can be searched a LOT faster.

Join the InvestorsHub Community

Register for free to join our community of investors and share your ideas. You will also get access to streaming quotes, interactive charts, trades, portfolio, live options flow and more tools.