Created
August 30, 2014 05:06
-
-
Save st0le/ddd93276ebd78605f307 to your computer and use it in GitHub Desktop.
Inversion Count - Using Naive Algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def inversionCount_1(A): | |
c = 0 | |
for i in xrange(len(A)): | |
for j in xrange(i + 1,len(A)): | |
if A[i] > A[j]: | |
c += 1 | |
return c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment