Ask your own question, for FREE!
Computer Science 19 Online
OpenStudy (anonymous):

Two elements a[i] and a[j] of an array form an inversion if a[i]>a[j] and i

OpenStudy (anonymous):

Two elements a[i] and a[j] of an array form an inversion if a[i]>a[j] and i<j. For example if the array is {4,9,2,8,7} then there are 5 inversions formed by the following pair of elements: (4,2), (9,2) , (9,8), (9,7), (8,7). Write a program that reads an array from the user and print the number of inversions

OpenStudy (harsimran_hs4):

What have you done so far ?

OpenStudy (anonymous):

so the number on the left has to be greater than the number on the right?

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!