> Data structures and algorithms: We used a dictionary instead of a list to go from O(S) to O(1) operations.<p>The list in TFA is so small that I wonder at what point creating a hashtable is more economical than going through a 9 items arrays. In C, accounting for allocations, etc. I would not be surprised that strcmp on an static array would be faster.<p>As always, measure with benchmarks (which does the article, but not on array vs. hashtable). In theory, O(1) is better than O(N). In pratice, with memory allocations and all, the order of magnitude of N plays a role.<p>Anyways, I would have used a hashtable also to convey the <i>idea</i> that I only want to check if the item is in the list. Python makes this easy. In C, I would have used an array unless N is "large enough".