Counting Inversions Adaptively [article]

Amr Elmasry
2015 arXiv   pre-print
We give a simple and efficient algorithm for adaptively counting inversions in a sequence of n integers. Our algorithm runs in O(n + n √((Inv/n))) time in the word-RAM model of computation, where Inv is the number of inversions.
arXiv:1503.01192v1 fatcat:url3d2uwyvcojcqg2lysmbna4u