title: Most frequent words in a terabyte of data
body: <p>I came across a problem where we have to find say the most 10 frequent words in a terabyte of file or string.</p>
  
  <p>One solution I could think was using a hash table (word, count) along with a max heap. But fitting all the words if the words are unique might cause a problem.
  I thought of another solution using Map-Reduce by splitting the chunks on different nodes.
  Another solution would be to build a Trie for all the words and update the count of each word as we scan through the file or string.</p>
  
  <p>Which one of the above would be a better solution? I think the first solution is pretty naive.</p>