Question: Can you help me to debug this c++ file? The correct answer is shown in Expected, and my answer is shown in received For the
Can you help me to debug this c++ file? The correct answer is shown in "Expected", and my answer is shown in "received"






![using namespace std; // Function prototype static long mergesort (int array[], int](https://s3.amazonaws.com/si.experts.images/answers/2024/08/66bdb94088257_76066bdb9403a7fc.jpg)
![scratch[], int low, int high); Counts the number of inversions in an](https://s3.amazonaws.com/si.experts.images/answers/2024/08/66bdb941225d9_76066bdb940b7a8c.jpg)
![array in theta(n 2) time. long count_inversions_slow(int array[], int length) // TODO](https://s3.amazonaws.com/si.experts.images/answers/2024/08/66bdb941c3a39_76166bdb9417399d.jpg)
For the test case 16, and 26, the number is {5 4 3 2 1 6 7 8 9 10}, so the inversion counter should be 2 (5 exchange with 1, and 4 exchange with 2), not 6, but I receive 11.
#include #include #include #include #include #include #include using namespace std; // Function prototype static long mergesort (int array[], int scratch[], int low, int high); Counts the number of inversions in an array in theta(n 2) time. long count_inversions_slow(int array[], int length) // TODO int j, i, key; long int ans-0; // Use insertion sort for slow run for 2sj && array[i] > key){ array[i1]-array[i]; anstt array[i 1]key; return(ans); #include #include #include #include #include #include #include using namespace std; // Function prototype static long mergesort (int array[], int scratch[], int low, int high); Counts the number of inversions in an array in theta(n 2) time. long count_inversions_slow(int array[], int length) // TODO int j, i, key; long int ans-0; // Use insertion sort for slow run for 2sj && array[i] > key){ array[i1]-array[i]; anstt array[i 1]key; return(ans)