For application code it's probably better to express clearly what you're trying to do, in this case keyed lookup. Throwing in a linear search at that level isn't just dangerous, it's potentially confusing to people reading the code later.
For application code it's probably better to express clearly what you're trying to do, in this case keyed lookup. Throwing in a linear search at that level isn't just dangerous, it's potentially confusing to people reading the code later.
Now, that doesn't mean you can't hash a, b, c, and d. It just means that the logic around doing the lookups is nontrivial.
When you are talking about < 100 elements, sometimes the consideration is "Welp, this is < 100, so lets just n^2 it".
Confused, what do you mean when you say the key is an "if" statement?
This comes up frequently when looking for fuzzy "duplicates".
For example, sometimes you get data from 2 sources, one will send it through with 0.01 precision. Another will send it through with 0.001 precision. You can't hash or compare that.
Things get more tricky when different finance institutes used different terms for the same entity.
That doesn't mean you can't avoid n^2 duplicate searches. It just means you have to be smart about how you group things.