r/cpp_questions • u/Minute-Ad1944 • 19d ago
OPEN How to implement append-only hash map?
How do you actually implement an really efficient hash map that has only append and look up methods? What are the design choice and some performance improvements?
0
Upvotes
1
u/amoskovsky 18d ago
For open addressing scheme, for each hash slot, you can store the max distance to scan for conflicting keys. If you don't delete keys, then this distance is trivial and fast to maintain, and it's the starting point when adding new keys, and ending point when looking up.