Amazon interview question

Sort an unsorted array and explain