Question: make a program in c++ that indicates how far/close the array is from being sorted. if array is already sorted then inversion count is 0

make a program in c++ that indicates how far/close the array is from being sorted. if array is already sorted then inversion count is 0

Example:

input array: [8, 4, 2, 1]

Output: 6

1) write pseudocode for a divide and conquer algorithm to compute inversion count of an input array

2) write recurrence relation of pseudocode as T(n) and solve it using substitution, iteration or master theorem

3) Write full program in c++. program must be in log n time

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!