Any intelligent way sorting an array?
As I know, there is one thing called bubble sort(sinking sort). i.e.
successive pairs of elements are compared
- if increasing order (or identical), no change
- if decreasing order, elements exchanged
repeat these steps for every element
However, (I think) swaping the values of two elements may not be efficient enough, so I try to create an array to record the index of the acsending order array.
So, this is only my thought, can someone give me a more intelligent way to sort an array and record it down?