I need a help in making an algorithm for solving one problem: There is a row with numbers which appear different times in the row, and i need to find the number that appears the most and how many times it's in the row, ex:
That would be 1 and it appears 5 times.
The algorithm should be fast (that's my problem). Any ideas ?
You could keep hash table and store a count of every element in that structure, like this
h = 5 h = 1 ...