An array of integers arr, of size n is defined as ajal... n-1). You will be given an array of integers to sort. Sorting must first be by frequency of occurrence, then by value. For instance, given an array 14,5,6, 5, 4, 3, there is one each of 6's and 3's, and there are two 4's, two 5's. The sorted list is 13. 6, 44, 5.5). Function Description Complete the function customSort in the editor below. The function must print the array each element on a separateline, sorted ascending first by frequency of occurrence, then by value within frequency customSort has the following parameter(s): arraro an array of integers to sort Constraints Isns 2 x 10 1 sarrus 106 Input Format For Custom Testing Input from stdin will be processed as follows and passed to the function The first line contains an integer n, the size of the integer array arr. The next n lines each contain an element arri. Sample Case o Sample Input 0 Sample Output 0 Explanation o n. 5, arr - 13.1.2.2.4 First we separate our numbers by frequency The subset of numbers having frequency $13.1.4) The subset of numbers having frequency 215 221 Our partially sorted data (with respect to and in ascending order of frequency can be expressed as (13.1.47.12.231 Then we sort each subset of elements having the same frequency in non-decreasing order, resulting in (1.3.0.12.2/1. Sample Case 1 Sample Input 1 Sample Output 1 Explanation 1 n.10, arr = 18.5.5.5.5. 1.1.4.4 First we separate our numbers by frequency The subset of numbers having frequency is a The subset of numbers of The subset of numbers having frequency 31st - un Explanation 1 n = 10, arr = 18,5,5,5,5, 1, 1, 1, 4.4) First, we separate our numbers by frequency The subset of numbers having frequency is (8) The subset of numbers having frequency 2 is 14) The subset of numbers having frequency 3 is ). The subset of numbers having frequency 4 is 5) Our partially sorted data (with respect to and in ascending order of frequency) can be expressed as (19.4 4 No more sorting is required. .5 5 5,5 View Code Diff 1 include
... - Complete the 'customSort' function below. The function accepts INTEGER ARRAY arr as parameter. void customSort(vector int> arr) { 17 18 19 20 int main()