本文发表在 rolia.net 枫下论坛Here is a question on how to combine keywords quickly.
Assume that following is a small part of a large static text file (we call it "key_file") that contains nearly one million lines.
30234804 highestpaysurveys.com
30234805 highestpaysurveys.org
30234806 highpaysurveys
30234807 highpaysurveys.com
30234808 hoem based
30234809 home automation market research
30234810 home based accounting jobs
30234811 home based employment
30234812 home based extra income
30234813 home based free jobs
30234814 home based internet
30234816 home based internet work
30234817 home based jobs
Now assume that I have keywords "home", "based", "free", "jobs" (this is a "keyword set"), how can I quickly combine them to get
30234813 home based free jobs
30234817 home based jobs
The principle is that the keyword records from the "key_file" are retrieved if and only if they occur in the keyword_set. Case and order of keywords are all ignored. For example, assume that the keyword_file aslo contains following
9999999 based home free jobs
then this keyword record should also be retrieved given the "keyword_set".
This is not database and there is no tables here. All I need to write C code to finish this project. So a good algorithm is really important.
Thanks so much!更多精彩文章及讨论,请光临枫下论坛 rolia.net
Assume that following is a small part of a large static text file (we call it "key_file") that contains nearly one million lines.
30234804 highestpaysurveys.com
30234805 highestpaysurveys.org
30234806 highpaysurveys
30234807 highpaysurveys.com
30234808 hoem based
30234809 home automation market research
30234810 home based accounting jobs
30234811 home based employment
30234812 home based extra income
30234813 home based free jobs
30234814 home based internet
30234816 home based internet work
30234817 home based jobs
Now assume that I have keywords "home", "based", "free", "jobs" (this is a "keyword set"), how can I quickly combine them to get
30234813 home based free jobs
30234817 home based jobs
The principle is that the keyword records from the "key_file" are retrieved if and only if they occur in the keyword_set. Case and order of keywords are all ignored. For example, assume that the keyword_file aslo contains following
9999999 based home free jobs
then this keyword record should also be retrieved given the "keyword_set".
This is not database and there is no tables here. All I need to write C code to finish this project. So a good algorithm is really important.
Thanks so much!更多精彩文章及讨论,请光临枫下论坛 rolia.net