C - Hashmap Activity
SWEN-250 - Personal Software Engineering
Overview
This exercise requires you to write C code that manages functions for a hashmap.
The provided file hashmap.c includes the following functions:
main( ) Contains the tests to exercise the solution.
insert( ) - inserts a key / value pair into the hashmap using symbol as the key
printHashtable( ) - print all the key / value pairs for the hash table
hash( ) - uses the given key to perform a hash function which computes the index (bin) into the hash table
lookup( ) - returns the hash table bin entry structure for a given key
drop( ) - removes the hash table bin entry structure for a given key and frees up memory
Instructions
- Download the zipfile:
hashmap.zip
- Read the instructions in the file for each of the functions
- Implement the code for the functions hash(), lookup() and drop(). Look at the file output.txt to view the expected results
- Build the code using
make
- Run your code by typing ./hashmap at the command line. This will run the tests in main.c against your implementation
- Compare your output to output.txt
Submission
Submit your code to a directory named hashmap in your git respository.
Grading scheme
- Clean build (10)
- hash function (10)
- lookup function (30)
- drop function (30)
- output matches output.txt (20)