Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ Need to compare one string to 200.000 words

Tags:

c++

compare

words

In my program in C++ ...

User types in program string "foo".

I need to compare this string to my strings, in txt files to write: this string is noun! (or adjective...)

I got few TXT files - one file with nouns, 2-nd file with adjectives... but in each file is about 200.000 words.

How I can effectively compare this string "foo" with strings in my files?

What I need to use?

like image 832
Kate83 Avatar asked Feb 28 '10 19:02

Kate83


1 Answers

Use TRIE data structure for this. You should need some memory for constructing the data structure. But your objective will be most efficient.

like image 58
bragboy Avatar answered Oct 08 '22 00:10

bragboy