C ++ program to count number of occurrences of each element in the array in O ( n ) time and O ( 1 ) space
#include <iostream> NEW_LINE using namespace std ; void findFrequencies ( int ele [ ] , int n ) { int freq = 1 ; int idx = 1 ; int element = ele [ 0 ] ; while ( idx < n ) {