I'm trying to figure out what data structure to quickly support the following operations:
- Add a string (if it's not there, add it, if it is there, increment a counter for the word)
- Count a given string (look up by string and then read the counter)
I'm debating between a hash table or a trie. From my understanding a hash table is fast to look up and add as long as you avoid collisions. If I don't know my inputs ahead of time would a trie be a better way to go?