{"id":13467899,"url":"https://github.com/jamesroutley/write-a-hash-table","last_synced_at":"2025-05-14T19:07:59.591Z","repository":{"id":39525124,"uuid":"99343496","full_name":"jamesroutley/write-a-hash-table","owner":"jamesroutley","description":"✏️ Learn how to write a hash table in C","archived":false,"fork":false,"pushed_at":"2023-12-16T14:30:33.000Z","size":53,"stargazers_count":3958,"open_issues_count":20,"forks_count":313,"subscribers_count":67,"default_branch":"master","last_synced_at":"2025-04-13T13:58:46.042Z","etag":null,"topics":["c","data-structures","hash-tables","tutorial"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesroutley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2017-08-04T13:05:13.000Z","updated_at":"2025-04-13T05:35:40.000Z","dependencies_parsed_at":"2024-11-29T04:01:42.299Z","dependency_job_id":"6d129e13-2798-4957-b2f9-76c5c7e6dab0","html_url":"https://github.com/jamesroutley/write-a-hash-table","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesroutley%2Fwrite-a-hash-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesroutley%2Fwrite-a-hash-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesroutley%2Fwrite-a-hash-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesroutley%2Fwrite-a-hash-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesroutley","download_url":"https://codeload.github.com/jamesroutley/write-a-hash-table/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254209859,"owners_count":22032897,"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":["c","data-structures","hash-tables","tutorial"],"created_at":"2024-07-31T15:01:02.222Z","updated_at":"2025-05-14T19:07:57.734Z","avatar_url":"https://github.com/jamesroutley.png","language":null,"funding_links":[],"categories":["Others","Tutorials"],"sub_categories":[],"readme":"[\u003cimg src=\"/.translations/flags/gb.png\"\u003e](/README.md) [\u003cimg src=\"/.translations/flags/fr.png\"\u003e](/.translations/fr/README.md)\n\n# Write a hash table in C\n\n[Hash tables](https://en.wikipedia.org/wiki/Hash_table) are one of the most useful data structures. Their quick and scalable\ninsert, search and delete make them relevant to a large number of computer\nscience problems.\n\nIn this tutorial, we implement an [open-addressed](https://en.wikipedia.org/wiki/Open_addressing), [double-hashed](https://en.wikipedia.org/wiki/Double_hashing) hash table in\nC. By working through this tutorial, you will gain:\n\n- Understanding of how a fundamental data structure works under the hood\n- Deeper knowledge of when to use hash tables, when not to use them, and how\n  they can fail\n- Exposure to new C code\n\nC is a great language to write a hash table in because:\n\n- The language doesn't come with one included\n- It is a low-level language, so you get deeper exposure to how things work at a\n  machine level\n\nThis tutorial assumes some familiarity with programming and C syntax. The code\nitself is relatively straightforward, and most issues should be solvable with a\nweb search. If you run into further problems, please open a GitHub\n[Issue](https://github.com/jamesroutley/write-a-hash-table/issues).\n\nThe full implementation is around 200 lines of code, and should take around an\nhour or two to work through.\n\n## Contents\n\n1. [Introduction](/01-introduction)\n2. [Hash table structure](/02-hash-table)\n3. [Hash functions](/03-hashing)\n4. [Handling collisions](/04-collisions)\n5. [Hash table methods](/05-methods)\n6. [Resizing tables](/06-resizing)\n6. [Appendix: alternative collision handling](/07-appendix)\n\n## Credits\n\nThis tutorial was written by [James Routley](https://twitter.com/james_routley),\nwho blogs at [routley.io](https://routley.io).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesroutley%2Fwrite-a-hash-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesroutley%2Fwrite-a-hash-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesroutley%2Fwrite-a-hash-table/lists"}