text: Traverse through array elements and count frequencies ( assuming that elements are limited by limit )
code: for ( int i = 0 ; i < n ; i ++ ) count [ arr [ i ] ] ++ ; for ( int i = 0 ; i <= limit ; i ++ ) if ( count [ i ] > 0 ) cout << i << " ▁ " << count [ i ] << endl ; }