Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: Algorithm o...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 4 Topic 45772 of 47032
Post > Topic >>

Re: Algorithm on search

by "Jim Langston" <tazmaster@[EMAIL PROTECTED] > May 6, 2008 at 05:47 AM

Vincent SHAO wrote:
> Search engine have to record all of the query string. Now i have a
> search engine log which contains 10 milllion query strings, but almost
> of them are repeated, not more than 3 million of them are non-
> repeated.
> My task is to pick the top 10 most popular query string, memory < 1G,
> the length of the query string is no more than 255.
>
> The faster, the better.
> the principal solutions, algorithm and data structure.
>
> Thank you.:-)

My first attempt would be to stuff the query strings into a map with the 
query string (or a hash of it) as the key, the number of times it occurs
as 
the data.

Then a loop to read the data and sort, or simply compare counts and store 
the keys for the top 10.


-- 
Jim Langston
tazmaster@[EMAIL PROTECTED]

 




 4 Posts in Topic:
Algorithm on search
Vincent SHAO <vincent.  2008-05-06 03:12:21 
Re: Algorithm on search
pjb@[EMAIL PROTECTED] (P  2008-05-06 14:15:56 
Re: Algorithm on search
"Jim Langston"   2008-05-06 05:47:30 
Re: Algorithm on search
James Kanze <james.kan  2008-05-07 01:21:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:15:54 CDT 2008.