Common Interview Question that comes up where you are asked to sort integers in an array based on the frequency. If there are ties, then you sort the integers in their natural order. For example: if given the array: [5, 2, 3, 1, 5, 5, 7, 10, 7]. This function should return: [5, 5, 5, 7, 7, 1, 2, 3, 10].
abelen / frequencysort Goto Github PK
View Code? Open in Web Editor NEWSorting algorithm that sorts on an array of integers based on the frequency. If the frequency is the same, then the natural ordering is used.