Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Lookup closest hash key

by LanX (Cardinal)
on Jan 25, 2011 at 09:28 UTC ( #884082=note: print w/replies, xml ) Need Help??


in reply to Lookup closest hash key

And what if two cities have the same distance???

Please don't use this hash, or at least invert it with reverse!

I agree with Grandfather, use a data structure prepared for optimizing many lookups, like a sorted array. If the logarithmic O of a simple binary search is still to expensive you can still try niftier things like weighted searches, nested lookup tables for intervals or trees.

Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://884082]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2021-01-17 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?