O(n) - associative array

The solution suggested by the lecturer is called an associative array, not a hash table.
In the associative array there is one array entry for each possible entry, so in this case we have an array size of 26 as there are 26 English letters. A hash table could reduce this size down to the length of the secret word using something called a hash function, but in this instance I think it would be inefficient.

Privacy & Terms