C # program to count number of occurrences of each element in the array in O ( n ) time and O ( 1 ) space
using System ; class GFG { public static void findFrequencies ( int [ ] ele ) { int freq = 1 ; int idx = 1 ; int element = ele [ 0 ] ; while ( idx < ele . Length ) {