TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Leapfrog Probing for open addressing hash tables

61 pointsby alanfranzoniabout 9 years ago

4 comments

cypharabout 9 years ago
The author doesn&#x27;t mention deletion (which is actually the most problematic part of open-addressing hash maps). If you use gravestones (which is the solution most people take) you end up with wasted space. You can optimise it slightly by retaining the stored key in the gravestone so if the key is set again, you can reuse that spot. However, and more optimisation starts causing orphaning problems. This is why I much prefer buckets because lots of removals don&#x27;t incur a sudden performance penalty.<p>Also, I can see that if your first delta hits another probe chain&#x27;s beginning, then you&#x27;ll end up with the same chain. This is slightly solved by quadratic probing, where your first and second multipliers have differing effects on the output so two chains that meet once aren&#x27;t forever locked together. Maybe if you incorporated some of the quadratic effect into Leapfrog this issue might be alleviated.
kelvin0about 9 years ago
It would have been nice to have some context with regards to the algorithm being explored. Although some ideas seem pretty clever, I&#x27;ve too often seen code implementing this in a haphazard way (buggy, no comments). This leaves the next programmer scratching their head and wondering ... why? Unless you have very specific performance and memory constraints, I do not see the need for such structures in most every programmers daily business.
评论 #11290459 未加载
hergeabout 9 years ago
Also an interesting variation on hash tables is the Cuckoo Hash (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Cuckoo_hashing" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Cuckoo_hashing</a>). However, I don&#x27;t think it makes a lot of effort in keeping marching keys near to each other, so I suspect Leapfrog probing might cause less cache misses.
评论 #11292842 未加载
failrateabout 9 years ago
I had a moment of panic where I had interpreted this as a security vulnerability in Leapfrog computer toys.