You are given an array of integers and you have sort those integers based on the frequency of
their occurrence. Design an algorithm and analyze its time complexity. In case of ties the smaller
number should appear first in the sorted list.
Sample Input: 3,4,3,2,3,5,4,2,2,1,2
Sample Output: 1 5 4 3 2