First page Back Continue Last page Graphics
Hash Functions
The “address calculator” is commonly referred to as the “hash function”.
A simple hash function to map phone numbers (7 digits) to an array of 10,000 elements:
- calculateAddress(int phone)
{
// return only the least four significant digits
return phone % 10000;
}