{"id":21311631,"url":"https://github.com/sreddy-96/top-hash-table","last_synced_at":"2025-03-15T20:42:57.772Z","repository":{"id":248780617,"uuid":"829339377","full_name":"SReddy-96/TOP-hash-table","owner":"SReddy-96","description":"The Odin Project - Hash Tables project","archived":false,"fork":false,"pushed_at":"2024-07-17T00:36:50.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T09:48:33.174Z","etag":null,"topics":["hash","hash-map","hash-table","hashing","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SReddy-96.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-16T08:28:56.000Z","updated_at":"2024-07-17T00:36:54.000Z","dependencies_parsed_at":"2024-07-17T04:08:38.217Z","dependency_job_id":null,"html_url":"https://github.com/SReddy-96/TOP-hash-table","commit_stats":null,"previous_names":["sreddy-96/top-hash-table"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SReddy-96%2FTOP-hash-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SReddy-96%2FTOP-hash-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SReddy-96%2FTOP-hash-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SReddy-96%2FTOP-hash-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SReddy-96","download_url":"https://codeload.github.com/SReddy-96/TOP-hash-table/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243790945,"owners_count":20348378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hash","hash-map","hash-table","hashing","javascript"],"created_at":"2024-11-21T17:19:07.709Z","updated_at":"2025-03-15T20:42:57.752Z","avatar_url":"https://github.com/SReddy-96.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hash Tables Implementation - The Odin Project\n\n## Project Overview\n\nThis project involves implementing custom Hash Map and Hash Set data structures in JavaScript. The goal is to create efficient hash-based data structures that can store and retrieve data quickly, while handling collisions effectively.\n\n## Key Features\n\n- Custom hash function for optimal bucket distribution\n- Collision handling using linked lists\n- Separate implementations for Hash Map (key-value pairs) and Hash Set (unique keys)\n- Dynamic resizing to maintain performance as the data structure grows\n\n## Core Functionalities\n\nBoth Hash Map and Hash Set implementations include the following methods:\n\n- `set(key, value)`: Add or update a key-value pair (Hash Map only)\n- `has(key)`: Check if a key exists\n- `get(key)`: Retrieve the value associated with a key (Hash Map only)\n- `remove(key)`: Delete a key-value pair\n- `length()`: Return the number of stored elements\n- `clear()`: Remove all entries\n- `keys()`: Return an array of all keys\n- `values()`: Return an array of all values (Hash Map only)\n- `entries()`: Return an array of key-value pairs (Hash Map only)\n\n## Technical Highlights\n\n- Prime number-based hash function to minimize collisions\n- Use of linked lists for efficient collision resolution\n- Constant time O(1) complexity for basic operations\n- Automatic resizing based on load factor to maintain performance\n\n## Challenges and Solutions\n\n1. **Efficient Hashing**: Implemented a hash function using prime numbers and modulo operation to distribute keys evenly across buckets.\n2. **Collision Handling**: Utilized linked lists within buckets to manage multiple entries with the same hash.\n3. **Dynamic Resizing**: Implemented a `_resize` method to increase bucket count when the load factor exceeds a threshold, maintaining performance as the data structure grows.\n\n## Skills Developed\n\n- Deep understanding of hash table internals\n- Improved problem-solving skills in handling edge cases and collisions\n- Enhanced proficiency in JavaScript, particularly with array operations and object-oriented programming\n\n## Reflections\n\nThis project provided valuable insights into the inner workings of hash-based data structures. It highlighted the importance of efficient hashing and collision resolution in maintaining constant-time operations. The implementation of dynamic resizing demonstrated the trade-off between memory usage and performance in data structure design.\n\n## How to Use\n\n1. Clone the repository:\n\n   ```\n   git clone https://github.com/SReddy-96/TOP-hash-table.git\n   ```\n\n2. Navigate to the project directory:\n\n   ```\n   cd hash-table\n   ```\n\n3. Run the script (if using Node.js):\n   ```\n   node index.js\n   ```\n\nFeel free to explore the code and test the various methods implemented in this Hash Table project!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsreddy-96%2Ftop-hash-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsreddy-96%2Ftop-hash-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsreddy-96%2Ftop-hash-table/lists"}