Сортировка пузырьком

Подчеркнутые элементы – элементы, которые сравниваются между собой на текущем шаге. Выделенные жирным шрифтом – элементы которые поменяли положение относительно предыдущего шага. Помеченные элементы – которые стали на свою последнюю конечную позицию.

Исхлдный массив 22, 202, 166, 15, 87, 52, 24, 7, 68, 42, 31, 12

Шаг 1.

22, 202, 166, 15, 87, 52, 24, 7, 68, 42, 31, 12

22, 202, 166, 15, 87, 52, 24, 7, 68, 42, 12, 31

22, 202, 166, 15, 87, 52, 24, 7, 68, 12, 42, 31

22, 202, 166, 15, 87, 52, 24, 7, 12, 68, 42, 31

22, 202, 166, 15, 87, 52, 24, 7, 12, 68, 42, 31

22, 202, 166, 15, 87, 52, 7, 24, 12, 68, 42, 31

22, 202, 166, 15, 87, 7, 52, 24, 12, 68, 42, 31

22, 202, 166, 15, 7, 87, 52, 24, 12, 68, 42, 31

22, 202, 166, 7, 15, 87, 52, 24, 12, 68, 42, 31

22, 202, 7, 166, 15, 87, 52, 24, 12, 68, 42, 31

22, 7, 202, 166, 15, 87, 52, 24, 12, 68, 42, 31

7, 22, 202, 166, 15, 87, 52, 24, 12, 68, 42, 31

Шаг 2.

7, 22, 202, 166, 15, 87, 52, 24, 12, 68, 42, 31

7, 22, 202, 166, 15, 87, 52, 24, 12, 68, 31, 42

7, 22, 202, 166, 15, 87, 52, 24, 12, 31, 68, 42

7, 22, 202, 166, 15, 87, 52, 24, 12, 31, 68, 42

7, 22, 202, 166, 15, 87, 52, 12, 24, 31, 68, 42

7, 22, 202, 166, 15, 87, 12, 52, 24, 31, 68, 42

7, 22, 202, 166, 15, 12, 87, 52, 24, 31, 68, 42

7, 22, 202, 166, 12, 15, 87, 52, 24, 31, 68, 42

7, 22, 202, 12, 166, 15, 87, 52, 24, 31, 68, 42

7, 22, 12, 202, 166, 15, 87, 52, 24, 31, 68, 42

7, 12, 22, 202, 166, 15, 87, 52, 24, 31, 68, 42

Шаг 3.

7, 12, 22, 202, 166, 15, 87, 52, 24, 31, 68, 42

7, 12, 22, 202, 166, 15, 87, 52, 24, 31, 42, 68

7, 12, 22, 202, 166, 15, 87, 52, 24, 31, 42, 68

7, 12, 22, 202, 166, 15, 87, 52, 24, 31, 42, 68

7, 12, 22, 202, 166, 15, 87, 24, 52, 31, 42, 68

7, 12, 22, 202, 166, 15, 24, 87, 52, 31, 42, 68

7, 12, 22, 202, 166, 15, 24, 87, 52, 31, 42, 68

7, 12, 22, 202, 15, 166, 24, 87, 52, 31, 42, 68

7, 12, 22, 15, 202, 166, 24, 87, 52, 31, 42, 68

7, 12, 15, 22, 202, 166, 24, 87, 52, 31, 42, 68

Шаг 4.

7, 12, 15, 22, 202, 166, 24, 87, 52, 31, 42, 68

7, 12, 15, 22, 202, 166, 24, 87, 52, 31, 42, 68

7, 12, 15, 22, 202, 166, 24, 87, 52, 31, 42, 68

7, 12, 15, 22, 202, 166, 24, 87, 31, 52, 42, 68

7, 12, 15, 22, 202, 166, 24, 31, 87, 52, 42, 68

7, 12, 15, 22, 202, 166, 24, 31, 87, 52, 42, 68

7, 12, 15, 22, 202, 24, 166, 31, 87, 52, 42, 68

7, 12, 15, 22, 24, 202, 166, 31, 87, 52, 42, 68

7, 12, 15, 22, 24, 202, 166, 31, 87, 52, 42, 68

Шаг 5.

7, 12, 15, 22, 24, 202, 166, 31, 87, 52, 42, 68

7, 12, 15, 22, 24, 202, 166, 31, 87, 52, 42, 68

7, 12, 15, 22, 24, 202, 166, 31, 87, 42, 52, 68

7, 12, 15, 22, 24, 202, 166, 31, 42, 87, 52, 68

7, 12, 15, 22, 24, 202, 166, 31, 42, 87, 52, 68

7, 12, 15, 22, 24, 202, 31, 166, 42, 87, 52, 68

7, 12, 15, 22, 24, 31, 202, 166, 42, 87, 52, 68

7, 12, 15, 22, 24, 31, 202, 166, 42, 87, 52, 68

Шаг 6.

7, 12, 15, 22, 24, 31, 202, 166, 42, 87, 52, 68

7, 12, 15, 22, 24, 31, 202, 166, 42, 87, 52, 68

7, 12, 15, 22, 24, 31, 202, 166, 42, 52, 87, 68

7, 12, 15, 22, 24, 31, 202, 166, 42, 52, 87, 68

7, 12, 15, 22, 24, 31, 202, 42, 166, 52, 87, 68

7, 12, 15, 22, 24, 31, 42, 202, 166, 52, 87, 68

7, 12, 15, 22, 24, 31, 42, 202, 166, 52, 87, 68

Шаг 7.

7, 12, 15, 22, 24, 31, 42, 202, 166, 52, 87, 68

7, 12, 15, 22, 24, 31, 42, 202, 166, 52, 68, 87

7, 12, 15, 22, 24, 31, 42, 202, 166, 52, 68, 87

7, 12, 15, 22, 24, 31, 42, 202, 52, 166, 68, 87

7, 12, 15, 22, 24, 31, 42, 52, 202, 166, 68, 87

7, 12, 15, 22, 24, 31, 42, 52, 202, 166, 68, 87

Шаг 8.

7, 12, 15, 22, 24, 31, 42, 52, 202, 166, 68, 87

7, 12, 15, 22, 24, 31, 42, 52, 202, 166, 68, 87

7, 12, 15, 22, 24, 31, 42, 52, 202, 68, 166, 87

7, 12, 15, 22, 24, 31, 42, 52, 68, 202, 166, 87

7, 12, 15, 22, 24, 31, 42, 52, 68, 202, 166, 87

Шаг 9.

7, 12, 15, 22, 24, 31, 42, 52, 68, 202, 166, 87

7, 12, 15, 22, 24, 31, 42, 52, 68, 202, 87, 166

7, 12, 15, 22, 24, 31, 42, 52, 68, 87, 202, 166

7, 12, 15, 22, 24, 31, 42, 52, 68, 87, 202, 166

Шаг 10.

7, 12, 15, 22, 24, 31, 42, 52, 68, 87, 202, 166

7, 12, 15, 22, 24, 31, 42, 52, 68, 87, 166, 202

7, 12, 15, 22, 24, 31, 42, 52, 68, 87, 166, 202

Шаг 11.

7, 12, 15, 22, 24, 31, 42, 52, 68, 87, 166, 202

7, 12, 15, 22, 24, 31, 42, 52, 68, 87, 166, 202