Consider the following code. What is a good hashing function for the array in Key to be used in an unordered_map?
#include
using namespace std;
enum TriState {
S0 = -1,
S1 = 0,
S2 = +1
};
struct K { // Key for the map
TriState a[8][8];
bool operator==(const K& k1) const {
for (int i = 0; i < 64; i++)
if (k1.a[0][i] != a[0][i])
return false;
return true;
}
};
struct Hash {
size_t operator()(const K& k) const {
size_t s;
// s = what is a good hash value?
return s;
}
};
unordered_map m;
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)