J.P. Morgan Interview Question

freq sorting a given data set and discussion on optimal method and time complexities