Glossary term
What is inversion? Meaning for developers
A pair of positions i < j where arr[i] > arr[j]. A sorted array has none. Bubble sort makes exactly one swap per inversion.
Learn it properly · DSALesson 16: Selection, Bubble and Insertion SortThree simple sorts that show what sorting really does.