Skip to content

Create your own map implementation using a hash table

Notifications You must be signed in to change notification settings

BYUCS235/Hashmap-Lab

 
 

Repository files navigation

Hashmap Lab

Instructions

Implement your own map using a hash table, like the C++ STL unordered_map class. The goal is to get your insert, find, and remove functions to have an average runtime of O(1).

Implement your hashmap in Hashmap.h (you are welcome to write a Hashmap.cpp if you prefer). Your hashmap will use keys of type string and values of type int.

You are welcome to use whatever collision-resolution strategy you prefer and implement that strategy any way you like (you just can't use map or unordered_map).

You should start your hash table capacity at 10 and double it each time you grow. You should use a load factor of 0.8. Constants for these values are found in HashmapInterface.h.

You are responsible for providing your own hash function. You can write your own or copy one from a reputable source (provide proper attribution in a comment). Find something that has the properties we discussed in class: deterministic, efficient, uniform, defined range.

Additional instructions for how to implement each method are found in HashmapInterface.h.

Testing

The tests used by the autograder are provided to you in tests.cpp. You can write your own additional tests in scratch.cpp.

The tests exercise all the methods defined in HashmapInterface.h.

About

Create your own map implementation using a hash table

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 99.1%
  • CMake 0.9%