Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Hashing function

  1. Nov 5, 2005 #1
    Hi folks!! I am working on a problem where there is a hash table involved. I have randomly distributed coordinates over a city as keys and i need a hash function to convert those coordinates to the positions of my array(hash table).I thought that maybe i could use a function to convert my coordinates to natural numbers and then using a common hash function. I am just a beginner, and my project is not very important, so most of all i need a simple solution.

    Any help would be much appreciated.
    Best regards, Paul.
  2. jcsd
  3. Nov 8, 2005 #2
    When you say the coordinates are random, what does that mean? Is the density of the points to be hashed greatest at the city centre, and decreasing gradually further away, or (less likely) is the density constant out to some limit, and then an abrupt stop?

    The distribution makes a difference to what would be the ideal hashing function, but maybe that doesn't matter - how many coordinates do you have to deal with?

    If the density varies with distance from the city centre, you might wish to convert the coordinates into polar form and then apply a linearising (inverse) function to the radius coordinate before hashing the bearing/distance pair.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook