Encountered this question but I couldn't solve with the complexity they solved it:
Suppose I have an array that the first and last $\sqrt[\leftroot{-2}\uproot{2}]{n} $ elements has $\frac{n}{5}$ inverted pairs, and the middle $n - 2\sqrt[\leftroot{-2}\uproot{2}]{n}$ elemnts are sorted. What is the complexity of sorting the unsorted array?
They claim in the answer that sorting array with $I$ inversions is $O(n\log{\frac{n}{I}})$.Why?
>
line prefix or "the"
button" in the post editor tool-bar.) Please check the problem statement: there are just so many values of $n$ where $\frac n 5$ does not exceed $1\ldots2 \times \sqrt n$. $\endgroup$