Morgan Stanley Interview Question

sorting algorithm