Our project explores the performance of hashmaps and heaps by comparing how effectively each data structure can retrieve the top k elements.
- Language: C++ 20
- Compiler: GCC 13.2
resources
US_Accidents_March23.csv
: contains the dataset from Kaggle
src
AttributeData.h
: contains a struct that is used by both data structuresDataNode.h
: contains a struct that is used to contain a single crash and all its data when parsingHashMap.cpp
HashMap.h
: a hashmap template class implemented from scratch with hashing and separate-chaining collision resolutionHeap.cpp
Heap.h
: a heap template class implemented from scratch using comparators and function pointersmain.cpp
: menu-driven program allowing users to learn about US accidents and compares data structures
cd [where you want to download]
git clone https://github.com/raglandconnor/CrashGuard
- Download US vehicle crash dataset
- Place inside
resources
folder
g++ -std=c++17 -c src/main.cpp -o main.o && g++ -std=c++17 -c src/HashMap.cpp -o HashMap.o && g++ -std=c++17 -c src/Heap.cpp -o Heap.o && g++ -std=c++17 main.o HashMap.o Heap.o -o CrashGuard
./CrashGuard
- US Accidents (2016 - 2023) Dataset
- Moosavi, Sobhan, Mohammad Hossein Samavatian, Srinivasan Parthasarathy, and Rajiv Ramnath. “A Countrywide Traffic Accident Dataset.”, 2019.
- Moosavi, Sobhan, Mohammad Hossein Samavatian, Srinivasan Parthasarathy, Radu Teodorescu, and Rajiv Ramnath. "Accident Risk Prediction based on Heterogeneous Sparse Data: New Dataset and Insights." In proceedings of the 27th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems, ACM, 2019.