I was studying Computer Science when I found myself upon a question which I cannot get an answer to. Here's my train of thoughts so far:
- Hash tables using open addressing need a probing function to resolve collisions, such as linear / quadratic probing, or double hashing.
- Linear probing is prone to primary clustering on the hash tables which could lead to degraded performance (referencing MIT's algorithm lecture)
- Found Swift's standard library uses Linear probing for it's Hash table implemention
Dictionary
(source code) - Then also learned that actually linear probing could be more performant(not sure) because of less cache misses (Wikipedia on Linear probing)
Linear probing can provide high performance because of its good locality of reference, but is more sensitive to the quality of its hash function than some other collision resolution schemes.
- But other laguages like Golang seems to use quadratic probing on it's hash tables
So I'm confused on what's a good probing strategy on hash tables now and why the Swift team went ahead and used linear probing on it's Dictionaries. Any thoughts would be welcome. Thanks.