hashtable - Hash Table Implementation - alternatives to collision detection -


other collision detection , throwing linkedlist in hashtable, other ways hash table can implemented? collision detection way achieve efficient hash table?

ultimately finite sized hash table going have collisions, @ least programmed one. if key type string hash table has infinite number of possible keys, hash table, have finite number of buckets. fundamentally there has collisions. if implement hash table ignores collisions, have strange, indeterministic data structure appear remove elements @ random.

now, data structure used on backend doesn't have linked list. implement red-black tree , log(n) performance out of collision. should checkout article 5 myths hash tables , this stack overflow question hashmaps vs maps.

now, if know key type, key 2 character long string, there finite number of possible keys, can proceed create "hash" function converts key relatively small integer, create look-up table guaranteed not have collisions.

it important note well-implemented hash table not suffer collisions. there bigger problems in world world hunger (or how implement efficient hash function) computer having traverse 3 nodes in linked list once every 5 days.


Comments