Miss a map key
Updated
A miss is a get (or contains-key) for a key that is not stored. The map is not empty necessarily. Other keys may be present. Returning 0, −1, or null is a policy you must name. The structure itself just says absent.
What to focus on
Missing 8 as a key is unrelated to whether 8 is a value. Do not confuse miss with value 0 stored under a real key.
Worked examples
absent among three
a = [4, 1, 9] as {4:2,1:8,9:3}, get 8- 8 is a value, not a key
Result: miss
absent one
a = [7] as {7:3}, get 4- only key is 7
Result: miss
empty miss
a = [], get 4- every get misses
Result: miss
Try it
Write get(m, k). m is the hash map. k is absent. Return miss. 8 as a value is not a hit for key 8. a = [4, 1, 9] as {4:2,1:8,9:3}, get 8 → miss. a = [7] as {7:3}, get 4 → miss. a = [], get 4 → miss.
keys and values are integers. The queried key is absent.