Word Frequencies
16.2 Word Frequencies: Design a method to find the frequency of occurrences of any given word in a book. What if we were running this algorithm multiple times?
Notes:
My approach was to scan through the book, and store the words as keys into a hash table. The word itself will hash to the words frequency. Naturally, this is the best approach with multiple queries as a preprocessing step in every subsequent operation would occur in O(1) time.
Last updated