I understand that I should not optimize every single spot of my program so please consider this question to be \"academic\"
I have maximum 100 strings and integer n
Well, you could store the strings in a binary tree and search there.
While this has O(log n) theoretical performance, it may be a lot faster in practise if you only have a few keys, that are really long, and that already differ in the first few characters.
I.e. when comparing keys is cheaper than computing the hash function.
Furthermore, there are CPU caching effects and such that may (or may not) be beneficial.
However, with a fairly cheap hash function, the hash table will be hard to beat.