Skip to content

Homework 4: Hash Table

Due Monday, July 17, 2023 at 11:59pm

In this assignment, you will implement free, insert, get, and remove functions of a chaining hash table.

  • Compile and test frequently
  • Read the entire assignment first before you start
  • Start early and do not do all of the assignment in one sitting; coding is fun but fighting for hours with broken code is not
  • Do not hesitate to seek help if you are stuck

Synopsis

I'll keep this write-up short since you have been doing this for three assignments now. In this homework, you will work in the lib directory.

lib/src/table.c: All code you are going to write for this assignment lives in this file. This file should implement the header at lib/include/table.h.

Written: You will answer some simple questions at the end.

Learning Objectives:

  • Hash Table

Getting started

See homework 3.

Specification

The specification of table is documented in the header file (include/table.h). If anything is uncleared, please let me know.

The implementation of everything other than table_free, table_get, table_insert, and table_remove is given to you as starter code. Read through the provided functions because they will give you a big hint for the functions that you will write.

Written

You need to answer some questions in hw3/WRITTEN.txt.

Submission checklist

In lib/:

  • src/map.c contains your implementation of the table_free, table_get, and table_insert, and table_remove functions.
  • make lib and make test produce no errors.

In hw4/:

  • WRITTEN.md is finished.

All changes are committed and pushed to your github repository. Submit your program to Gradescope by selecting your coursework directory and the correct branch.

Grading

Percentage
Correctness 70%
Style 20%
Written 10%

Warning: If your program cannot be compiled using the commands above without error or warning, you will receive 0 points in correctness since there is no executables for us to run.