Foundations — Bubble sort, selection sort, insertion sort — O(n²), when insertion sort wins
Before you can read a single line of the parent note, you must own every symbol it throws at you without warning. This page builds each one from nothing — plain words, then a picture, then why the topic needs it. Read top to bottom; each block uses only what came before.
1. An array and its index
So is the first box, the second, and the last box in a row of boxes is .

Why the topic needs it: every sentence like "shift A[i] left" or "swap index 0 with index 1" is meaningless until you can point at exactly one box. The index is the finger you point with.
2. The size n
Why the topic needs it: we want to describe speed as the array grows. Saying "it took 3 comparisons" is useless on its own; saying "it took about comparisons" tells you what happens when becomes a thousand or a million. Every cost formula in the parent note is a recipe with as the ingredient.
3. Comparison < and swap

These are the only two moves a comparison sort is allowed. It may look at two values and ask which is bigger, and it may move values between boxes. Nothing else.
Why the topic needs it: the parent note counts comparisons and moves as its measure of work. To count them you must first agree that these — and only these — are the atomic actions. That is exactly the comparison-sort model, and it is what makes the wall these three sorts cannot beat.
4. The inversion — the star of the whole topic

Read the picture: draw an arrow from every box to every box on its right. Colour the arrow red if the left value is bigger (out of order) and green if it is fine. The red arrows are the inversions.
Why the topic needs it: this single count is the reason insertion sort wins. Each time insertion sort slides an element one box left, it flips exactly one red arrow to green. Nearly-sorted data starts with few red arrows, so insertion sort barely works. See Inversions and Counting for the deeper theory, and Stability in Sorting for what happens to equal values (which are never inversions — is strict).
5. Adding up
Every cost formula in the parent note ends in the same sum, so we must own it. The symbol (Greek capital "sigma", for Sum) is shorthand for "add up a list":
Read it as: "let walk from up to , and add every you land on."

Why the topic needs it: selection sort's scan on pass makes fewer comparisons each time — , then , down to . Adding those up is this triangle. Same story for bubble's worst case and insertion's worst case. Knowing the sum is is knowing why all three are quadratic.
6. What "" actually says
Watch it happen to our triangle:
For the first piece is and the second is only — the term drowns everything. So we call it .
Why the topic needs it: "these three are all " and "insertion drops to when nearly sorted" are the parent note's two headline claims — both are statements in this language.
7. Best / worst / average case
Why the topic needs it: Big-O alone hides the punchline. Bubble and insertion share the worst case , yet insertion has a best case of that bubble-with-a-flag matches but selection can never reach. The whole "when insertion wins" argument lives entirely in the gap between best and worst. This adaptiveness is why real libraries — Timsort, Introsort — drop to insertion sort for tiny chunks before handing off to Merge Sort or Quicksort.
Prerequisite map
Read it top-down: boxes and indices let you point; pointing lets you compare and swap; comparing defines the inversion; the triangle sum plus Big-O turn counts into growth shapes; and inversions + cases together explain the winner.
Equipment checklist
Cover the right side and answer each aloud. If any stumps you, re-read that section before opening the parent note.