Please explain that mid -(i-1) again with more clarity .
Recursion inversion Count
Hey @vanshikasharma1645, i guess you are having a problem here,
since prateek bhaiya has explained that if there are two arrays that are to be compared:
elements ->x x 5 6 7 8 && x 2 ! ! !
index val->0 1 2 3 4 5 && 0 1 2 3 4
so you can see that a[2] i.e., 5 is greater then a[1] i.e., 2
so all the elements in front of 5 including 5 will make inversion count. But how can we calculate all the elements in front of 5 including 5 too. for that we can see that mid which is index 5 and i which is index 2 is subtracted and added with 1 , we get all the count in front of 5 including 5 i.e.,
cnt=5-2+1 i.e., 4
Therefore 4 elements will make inversion count with element 2 in another array.
Hope this will help you in understanding question 
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
