f*****e 发帖数: 57 | 1 Say you have a file containing name value pair, such as
foo: bar
a: b
foo: bar
a: c
The file may be huge, but the number of names are limited.
Given a name, find out how many times the name occurs in the file.
It looks to me there is a straight forward solution using hash table:
we preprocess the file, hash each name into the table, and keep the
count. We then use the same table to look up the name occurrence.
This should be programmed in C, so not stl. |
|