Won't this be easy, just maintain seperate queue for each element and insert the element into the corresponding queue by dynamic memory allocation, then the queue for which front-reverse is the maximum will have maximum frequency
Won't this be easy, just maintain seperate queue for each element and insert the element into the corresponding queue by dynamic memory allocation, then the queue for which front-reverse is the maximum will have maximum frequency
or rather, may be you can use bucket sort, declare a two dimensional array provided you already know the range. just push the number into the corresponding bucket and based on the frequency you can then push it into the stack
don't make this simple thing complex, declare a 2 dimensional array of large size. and assign a[i][0]=i; if the array element exists already a[i][1]=i; Count the frequencies and store it in a seperate array 10 11 12 13 14
10 11 13 14
10 11
11 as shown. now sort the frequencies and display the contents of the corresponding buckets