Skip to content
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

Added Robin Hood Hashing in Hashmap for Optimized Probe Length Management #1542

Merged
merged 2 commits into from
Nov 2, 2024

Conversation

divyalakshmi0
Copy link
Contributor

Title: Add Robin Hood Hashing Algorithm for Optimized Hash Table Collisions

Issue: #1462

Description:
This PR introduces an implementation of the Robin Hood Hashing Algorithm, a variation of open addressing designed to reduce clustering and improve the lookup and insertion efficiency in hash tables. Robin Hood hashing balances load by minimizing the maximum probe distance for each entry, ensuring more efficient performance even at high load factors.

Changes:

  • Added robin_hood_hashing.c implementing the Robin Hood Hashing Algorithm in C.
  • Functions included:
    • insert: Inserts key-value pairs with probe distance adjustments.
    • search: Searches for keys with minimized probe distances.
    • delete: Marks elements as deleted to preserve probe order.
  • Added test cases for insertion, search, and deletion to validate the functionality and efficiency of the implementation.

Motivation:
Robin Hood Hashing reduces clustering in hash tables by balancing probe distances, making it useful for handling high load factors efficiently. This feature will help users working with dense datasets and scenarios requiring fast lookups.

How it helps:

  • Efficient Access: Reduces maximum probe length, improving average lookup time.
  • Improved Load Balancing: Decreases clustering, maintaining stable access times even with a high load factor.
  • Optimal Collision Handling: Ensures minimal probe distance through dynamic insertion ordering.

Testing:

  • Basic insertion, search, and deletion cases with different key-value pairs.
  • Edge cases including collisions and deletion of existing elements.

Additional Notes:
This implementation adds value for users who handle large datasets in hash tables and require optimal collision resolution.

@pankaj-bind pankaj-bind merged commit bf491d1 into AlgoGenesis:main Nov 2, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants