is it possible to find a optimal sorting algorithm with a given number of elements in a presorted sequence and a inversions number or a Pearson's r of that sequence?
For example I have a presorted sequence of 262143
elements.
The maximum amount of inversions is donated by (n(n-1))/2
where n
is the number of elements in the sequence (see here page 2 for this assumption). For this example the maximum is therefor 34359345153
.
Now the number of inversions of my presorted sequence is 1299203725
which is 3.78%
of the maximum. My Pearson's r is 0.9941
. By my understanding this should be a presorted sequence with a high "sortedness" (Please correct my if I'm wrong).
I found many references to the number of inversions and the Person's r as a way to define the "sortedness" of a sequence but I could not get some kind of comparison for which number of elements and inversions/Pearson's r which sorting algorithm is the preferred one.
Thanks for your help.