Skip to content

mrfisch3r/c-string-hashmap-resizable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Resizable String Hash Map (C)

An educational hash map implemented in C with string keys and generic pointer values (void*).
Uses separate chaining for collisions and supports load factor + resizing (rehashing).

This repository contains only code and documentation written by me (no course handouts/prompts or instructor-provided tests).

Features

  • put(key, value) — insert/replace (returns previous value or NULL)
  • get(key) — lookup (returns value or NULL)
  • remove(key) — delete (returns removed value or NULL)
  • getloadfactor() — returns size / buckets
  • resize(targetLF) — resizes bucket array to approach a target load factor and rehashes entries

Project layout

  • src/strmap.c — implementation
  • src/strmap.h — public API
  • demo.c — small demo harness
  • tests/ — test suite (basic, edge keys, resize invariants, fuzz-ish)

Build & run (Windows + GCC/MSYS2)

From the repo root:

gcc -Wall -Wextra -std=c11 -Isrc -o demo.exe demo.c src\strmap.c
.\demo.exe

About

Resizable C hash map with load factor tracking and rehashing; includes demo + tests

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages