《Cracking the Coding Interview》——第17章:普通题——题目9

2014-04-28 23:52

题目:设计算法,找出一本书中某个单词的出现频率。

解法:数就行了。

代码:

 1 // 17.9 Given a book, find out the occurrences of any given words in it.
 2 // Answer:
 3 //    1. process the book as a text file.
 4 //    2. find all words, definition of a word must be clearly asserted.
 5 //    3. use map or hash table to record the occurrences of words.
 6 //    4. query the statistics for an answer.
 7 int main()
 8 {
 9     return 0;
10 }
原文地址:https://www.cnblogs.com/zhuli19901106/p/3698286.html