Sorting element of an array by frequency in decreasing order
Given an array arr[] of N integers. The task is to sort the array arr[] according to the frequency of elements in decreasing order. Note: If the frequencies of the two elements are the same, then the smaller element should come first. Examples: Input: arr[] = { 4, 4, 5, 6, 4, 2, 2, 8, 5 } Output: 4