find most occurred item in a set in C#

Posted by Anant under C# on 2/19/2014 | Points: 10 | Views : 858 | Status : [Member] | Replies : 1
I want to find most occurred item in a set. For example in { 5, 4, 5, 2, 8, 4, 12, 4, 2 } the answer is 4. Assume items are of type int. If i have multiple items with equal max number of occurrences anyone would be the answer.




Responses

Posted by: Bandi on: 2/19/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer
http://nickstips.wordpress.com/2010/10/14/c-get-the-most-common-mode-element-from-a-collection/
http://stackoverflow.com/questions/2655759/how-to-get-the-most-common-value-in-an-int-array-c

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Anant, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response