1#ifndef ULT_HASH_TABLE_H_INCLUDED
2#define ULT_HASH_TABLE_H_INCLUDED
42 return (mKey == item.mKey);
75 mTable =
new std::vector<HashItem<T>>[mSize];
95 mTable[hash].push_back(obj);
104 std::vector<HashItem<T>>* ptr = &mTable[hash];
105 for (
auto it = ptr->begin(); it != ptr->end(); it++) {
121 std::vector<HashItem<T>>* ptr = &mTable[hash];
122 for (
int i = 0; i<(int)ptr->size(); i++) {
150 unsigned long hash = 0;
151 for (
int i=0; i<(int)str.size(); i++) {
152 hash = (hash * 131) + str[i];
154 return int(hash % mSize);
164 std::vector<HashItem<T>>* mTable;
Definition HashTable.h:16
T GetObject()
Definition HashTable.h:36
bool operator==(const HashItem &item)
Definition HashTable.h:41
void SetObj(T obj)
Definition HashTable.h:38
HashItem & operator=(const HashItem &item)
Definition HashTable.h:45
HashItem()
Definition HashTable.h:21
void SetKey(int k)
Definition HashTable.h:33
int GetKey() const
Definition HashTable.h:31
~HashItem()
Definition HashTable.h:27
void Delete(const int key)
Definition HashTable.h:100
int HashFunction(const int key) const
Definition HashTable.h:135
void Insert(const HashItem< T > &obj)
Definition HashTable.h:93
HashItem< T > Find(int key)
Definition HashTable.h:117
HashTable(int size)
Definition HashTable.h:69
int GetSize() const
Definition HashTable.h:160
~HashTable()
Definition HashTable.h:81
int HashFunction(const std::string &str)
Definition HashTable.h:141