Learnacy Lab

Insertion Sort and Inversions · Computer Science

Each bar is lifted and slid left into a sorted prefix; the total number of shifts is exactly the number of inverted pairs.