My textbook is assuming that a three-character String key is being input into this hash function. I understand that there are 26 letters in the alphabet + 1 possible blank, but why is this program multiplying the second and third characters by 27 and 729? Is this just an arbitrary way to generate a hash value?
public static int hash(String key, int tableSize)
return (key.charAt(0) + 27 * key.charAt(1) + 729 * key.charAt(2)) % tableSize;