searching algorithm
aaronwmail-usenet at yahoo.com
aaronwmail-usenet at yahoo.com
Sat May 12 14:00:29 EDT 2007
On May 10, 1:26 pm, Gigs_ <g... at hi.t-com.hr> wrote:
> Hi all!
>
> I have text file (english-croatian dictionary) with words in it in alphabetical
> order.
> This file contains 179999 words in this format:
> english word: croatian word
Let's assume it's okay to have all the data in memory.
In my experience the very fastest way to do what you
want is to store the strings in a sorted list and use
the binary search library module bisect. I once compared this
with doing something similar with tries and it was
much faster. It's also the most simple way to do it, which
is nice too :).
-- Aaron Watters
===
never eat anything bigger than your head -- kliban
More information about the Python-list
mailing list