[2,1,9,1,2,5,1,6,1]. transforms to ----> [5,6,9,2,2,1,1,1,1]
follow the above transformation .
//if frequency is same ascending order is to be maintained. 5,6,