演算法 Inversions

Let A[1..n] be an array of n distinct numbers. If i<j and A[i]>A[j], then the pair (i,j) is called inversion of A. a. List the five inversions of the array <2,3,8,6,1> b.What array with elements from the set {1,2,..n} has the most inversions? How many does it have? c.What is the... show more Let A[1..n] be an array of n distinct numbers. If i<j and A[i]>A[j],
then the pair (i,j) is called inversion of A.

a. List the five inversions of the array <2,3,8,6,1>
b.What array with elements from the set {1,2,..n} has the most
inversions? How many does it have?
c.What is the relationship between the running time of insertion sort
and the number of inversions in the input array? Justify your answer
1 answer 1