What is the best way to find the most recurring values in a set? I’d like to use a one-pass algorithm, assuming that values are from the 1,2,3,4,..,m domain?
If I had to write an algorithm to do that, how would I do that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Store them in a hash table, with a count of how many times each one was stored (O(n)).
Then loop through the buckets (O(n)).