-
-
Save VitamintK/1e8c790ebf97a885ae16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////////////////////////////////////// | |
// | |
//Private helper methods | |
template<class KEY,class T, int (*thash)(const KEY& a)> | |
int HashMap<KEY,T,thash>::hash_compress (const KEY& key) const { | |
return (abs(this->hash(key)) % bins); | |
} | |
template<class KEY,class T, int (*thash)(const KEY& a)> | |
typename HashMap<KEY,T,thash>::LN* HashMap<KEY,T,thash>::find_key (int bin, const KEY& key) const { | |
} | |
template<class KEY,class T, int (*thash)(const KEY& a)> | |
typename HashMap<KEY,T,thash>::LN* HashMap<KEY,T,thash>::copy_list (LN* l) const { | |
LN* last = LN(l); | |
LN * first; | |
LN* to_return = last; | |
if(l == nullptr){ | |
return nullptr; | |
} | |
for(LN* k = l->next; k != nullptr; k = k->next){ | |
LN * first = LN(k); | |
last->next = first; | |
last = first; | |
} | |
return to_return; | |
} | |
template<class KEY,class T, int (*thash)(const KEY& a)> | |
typename HashMap<KEY,T,thash>::LN** HashMap<KEY,T,thash>::copy_hash_table (LN** ht, int bins) const { | |
LN** new_table = new LN*[bins]; | |
for(int i = 0; i < bins; i++){ | |
new_table[i] = copy_list(ht[i]); | |
} | |
return new_table; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment