logoalt Hacker News

teo_zero12/09/20241 replyview on HN

Right.

Thinking about it, I don't grasp why the author has opted for linear probing here. Given the amount of malloc(), they might have used linked lists as well.


Replies

eqvinox12/10/2024

Well, chained hash maps are significantly slower in the face of collisions due to the memory fetch latency hit to grab the next item... even ignoring the academic O(n) lookup, memory is often the primary perf constraint these days...

And for an exercise, it might be worth implementing linear probing just to get more learning experience out of it(?)

show 1 reply