The average number of inversions in an array
of n
records is n(n-1)/4
. This is:
\Theta(n^2)
\Theta(n^2)
\Theta(n^2)
n(n-1)/4 = n^2/4 - n/4
.
From the rules on asymptotic analysis,
\Theta(n^2/4 - n/4)
is \Theta(n^2)