Recently, it was necessary to do a task in which one of the subtasks was to find the most frequently occurring element in the array. If suddenly someone did not understand, an example:
Dan array: 3 4 5 3 6 7 5 3 3 3 3 8 5 4
Here the most common troika. Here it is necessary to withdraw
Click on the idea / algorithm with which you can implement it all?
ps solution was the following: create an array, the dimension of which is the maximum possible element in the array, then add to this array one by one when you meet an element from the first array. So go through the array, and then sort the second array by age and output the last element. But I think that this is a little perversion.