Hi,
I've been forced to rely on HashMaps, Hashtables, etc. without, unfortunately, a good understanding of how they work... And, there's not much literature (either comprehensible or available) I've been able to find.
I understand a hash table to be a contiguous section of memory, apportioned into "bins". Provided with an object to be stored in the table, a hashing function calculates a key which determines where in the table the object is to be stored - the key calculated such that 1: collisions are minimized and 2: lookup times are small.
is this correct? And - how can I reconcile this with the fact that, in Java, one can provide keys - keys which can have no relation whatsoever to the value? Presumably, in the class HashMap, it is the "value" objects that are hashed but what, then, is the role of the hashing function if I can (and do!) specify my own key????? This is confusing..
Thank you! please forgive my idle curiosity...
dora
I've been forced to rely on HashMaps, Hashtables, etc. without, unfortunately, a good understanding of how they work... And, there's not much literature (either comprehensible or available) I've been able to find.
I understand a hash table to be a contiguous section of memory, apportioned into "bins". Provided with an object to be stored in the table, a hashing function calculates a key which determines where in the table the object is to be stored - the key calculated such that 1: collisions are minimized and 2: lookup times are small.
is this correct? And - how can I reconcile this with the fact that, in Java, one can provide keys - keys which can have no relation whatsoever to the value? Presumably, in the class HashMap, it is the "value" objects that are hashed but what, then, is the role of the hashing function if I can (and do!) specify my own key????? This is confusing..
Thank you! please forgive my idle curiosity...
dora