If the range of values is small, e.g. 0-10 as in your example, you can solve your problem with a single pass through the array. Set up a counting array NrA[] of integers, with one element for each possible value in your original array A[]. Zero all elements of NrA. Then go through A and for each element, say V = A[J], add 1 to NrA[V], the number of occurrences of value V. When you're finished, the counting array will contain, for each V, the # of times V occurs as a value in A.
Suppose your initial array is A[0..9] = 1 2 1 2 4 2 5 2 6 9 as in original post, then when you're finished, your counting array will be NrA[0..10] = 0 2 4 0 1 1 1 0 0 1 0. E.g., NrA[2] = 4 since A contains 4 elements equal to 2, and in gerneral NrA[J] = the number of J's in A. The most frequently occurring element is the index of the largest value in NrA, namely 2 in this case since NrA[2} is the max value in NrA.
This method works in linear time O(n+m), where n is the number of elements and m is the number of possible values. It's the fastest possible sorting method in cases where the range of values is small enough, since it involves no comparisons at all and looks at each element exactly once.