Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this question, you are asked to implement a hash table ADT in two modules: the ht module with the public interface and the ht
For this question, you are asked to implement a hash table ADT in two modules: the ht module with the public interface and the htimpl module with private declarations and definitions. You are given a header file, hth which describes the public interface for the hash table abstract data type. You will implement those function signatures in a file called htc and declare any additional private datatypes
and functions in another header, called htimpl.h Skeleton versions of these additional files are provided. You will first test your hash table ADT with a separate program, before using it to implement a postal code collator. The public interface must be complete, and its header file must not be changed.
In this assignment, our keys will be C strings; however, for hash tables in general, this need not be the case.
Our requirements for your hash table are as follows:
Both the keys and the values that they are mapped to are strings;
Amortized O lookup, insert, and deletion for an arbitrary number of elements;
Safe, correct dynamic memory usage.
Below are some topics which you should investigate and include in your design, including some questions to be answered in the design document.
Highlevel operations and the public interface
Hash functions, The Division Method
Collision resolution
Table resizing
Data Structures
Testing:
A separate program, named Test.c to test the hash table implementation. This program must call each of the functions from hth
Required files:
hth already given in picture
htc
htimpl.h
htimpl.c
htTest.c
Most important thing for this question are defining structs for which skeleton is given in hth
Skeleton version of htc:
#include hth Import the public hashtable header.
#include htimpl.h Also import the private header.
struct hasht
I have attached picture of hth from which you can create htc and rest header and source file from question.
Thank you!!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started