Question: a . The five inversions of the array [ 2 , 3 , 8 , 6 , 1 ] are: ( 2 , 1 )
a The five inversions of the array are:
b The array with elements from the set n that has the most inversions is the array sorted in descending order. It has nn inversions.
c The running time of insertion sort is proportional to the number of inversions in the input array. This is because each inversion corresponds to a pair of elements that are out of order and need to be swapped, and each swap takes constant time.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
