Skip to content

HashTable (HashMap) with open addressing implementation

Notifications You must be signed in to change notification settings

NURx2/HashTable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d7ab5a1 · May 2, 2019

History

15 Commits
Apr 14, 2019
May 2, 2019
Apr 14, 2019

Repository files navigation

HashMap

Own C++17 hashtable header

Usage examples

Including of the header file

#include <HashMap.h>

> Variable declaration

HashMap<int, int> myHashmap{{1, 2}, {0, 0}};

Correctly works with constness

const HashMap<int, int> myConstHashmap{{1, 5}, {3, 4}, {2, 1}};

> Usage of iterators

HashMap<int, int>::iterator it = myHashmap.end();
HashMap<int, int>::const_iterator it2 = myConstHashmap.begin();
for (auto cur : myHashmap) {
    std::cout << cur.first << ' ' << cur.second << "\n";
}

.find() implementation

const HashMap<int, int> myConstHashmap{{1, 5}, {3, 4}, {2, 1}};
HashMap<int, int>::const_iterator it;
it = myConstHashmap.find(3);  // it->second == 4
it = myConstHashmap.find(7);  // it->second == myConstHashMap.end()

for more examples look at test.cpp

About

HashTable (HashMap) with open addressing implementation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages