in reply to Setting In-between values in a hash (interpolating)

If you have *lots* of numbers or if you did often, it would be better to use a binary search on a sorted array rather than using a hash.

dreadpiratepeter'sO(N log N)
Best hashO(N)
Best unsorted arrayO(N)
Binary search
(must be sorted)
O(log N)

Update: Added links.

  • Comment on Re: Setting In-between values in a hash (interpolating)

Replies are listed 'Best First'.
Re^2: Setting In-between values in a hash (interpolating)
by dreadpiratepeter (Priest) on Sep 26, 2008 at 21:28 UTC
    lol, didn't know I was being graded ;) Never said it was a good solution, just a solution. My gut feeling is that he is asking the wrong question and there is a better solution for what he is trying to do.


    -pete
    "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."