[thelist] Phone Number Word Permutation Algorithm
Fred Jones
fredthejonester at gmail.com
Wed Dec 3 13:06:08 CST 2008
> Fred, that is likely slightly faster, but this is not really the point
> of the suggestion. Let me try to explain.
Ah! <Fred smacks himself on the forehead>. What you are really saying is:
FIRST, if you convert first your words to numbers then you can index
on the number strings, because while you are correct that one number
string can be permutated into thousands of letter strings, what is
valuable to understand is the converse--you can condense thousands of
letter strings into one number string and just search for a match on
those.
SECONDLY, if you only must search on numbers, then there are only
maybe 20 number combinations you must search on. Instead of 10K letter
combinations.
Well done, Matt. I think that is the solution. The first point above
actually didn't work out as I thought--from a pool of 166K words (I
removed the really big ones) I derived 151K unique integers. But the
second point, and this what you were actually communicating, is
obviously a savings of a factor of ~ 500.
It works perfectly. I ran a search now on 10 digits 8748674268 and it
takes 2 seconds or less on my workstation.
Thank you very much--you are a genius!
PS: Do you know what results you get from 8748674268? One of them is:
triumphant
:)
More information about the thelist
mailing list