inversion number and quicksort in algorithms design and analysis, writen in Python