Whither binary search?
Neil Cerutti
horpner at yahoo.com
Thu Sep 28 12:01:43 EDT 2006
On 2006-09-28, Sion Arrowsmith <siona at chiark.greenend.org.uk> wrote:
> John Machin <sjmachin at lexicon.net> wrote:
>>Fredrik Lundh wrote:
>>> well, people tend to use dictionaries when they need to look things up
>>> quickly...
>>... like those paper dictionaries with the words in alphabetical order
>>:-)
>
> ... where you'll notice that the really big ones are divided up
> into buckets (which just happen to be keyed on initial letter).
>
> Truth is that humans are lot better than computers at general
> insertion sort, and its lookup equivalent, whereas computers
> are much better at calculating hashes. So we each use a
> dictionary implementation that plays to our strengths.
Thanks all, for the help.
In the end, perhaps prophetically, it turned out my data wasn't
really fully sorted after all. I put together a short function to
translate my raw data into a dictionary, and that was the end of
my problem.
--
Neil Cerutti
More information about the Python-list
mailing list