how to find complete sorting of elements by frequency?
问题 Here is the problem: Given an array of integers, sort the array according to frequency of elements. For example, if the input array is {2, 3, 2, 4, 5, 12, 2, 3, 3, 3, 12}, then modify the array to {3, 3, 3, 3, 2, 2, 2, 12, 12, 4, 5}. if 2 numbers have same frequency then print the one which came 1st. I know how to do it partially. Here is my approcach. I will create a struct which will be like: typedef struct node { int index; // for storing the position of the number in the array. int count;