Explore BrainMass

C++: Hash function object type (hFint256)

Consider the hash function object type

Class hFint256
unsigned int operator() (int item) const
Return (item/16 % 256);

(a) What is the size of the hash table?
(b) What are hFint256() (16) and hFint256() (257)?
(c) In general, what is the action of the hash function?


Solution Preview

(a) Since the last operation in computation of hash value is "% 256", it indicates that any item value will be hashed to a value in the range [0,255], thereby meaning that ...

Solution Summary

Brief explanations and stepwise calculations included.