Ericsson Interview Question

sorting the given array with less time complexity