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

  1. Download the zipfile:
  2. hashmap.zip
  3. Read the instructions in the file for each of the functions
  4. Implement the code for the functions hash(), lookup() and drop(). Look at the file output.txt to view the expected results
  5. Build the code using make
  6. Run your code by typing ./hashmap at the command line. This will run the tests in main.c against your implementation
  7. Compare your output to output.txt

Submission

  • Submit your code to a directory named hashmap in your git respository.
  • Grading scheme