-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mutable hash map #93
Conversation
80f4efe
to
5799d31
Compare
d12fc41
to
84168f9
Compare
I feel the implementation of the hash table should be considered to reference modern implementations in Rust and Cpp. It's preferable to use integers rather than float points arithmetics to estimate the load factor. And it's not common to use a large load factor for Robin Hood hash table, considering that it will quickly be worse than a sorted array by hash values. Also for #90. |
Integer arithmetics will be better. Maybe we can do a benchmark to find a better load factor? |
I think it should be fine between 0.5 and 0.75. But doing a benchmark should be a better approach for this. |
I think It's ready to merge if current load factor (13/16 about 81.25%) is acceptable. We can optimize the load factor or the implementation of the hash table later. |
@yj-qin If you are ready, we are merging this |
This PR adds a mutable hash map implements with Robin Hood Hashing. It based on an open-addressing hash table that uses linear probing to resolve hash collisions. When removing key-value pairs, it uses the shift-back method for reordering.