Process Overview
Sorting algorithms arrange items in order. Bubble sort swaps neighbors to push the largest to the end. Selection sort finds the smallest and places it at the start. Both repeat until sorted.
Sorting algorithms arrange items in order. Bubble sort swaps neighbors to push the largest to the end. Selection sort finds the smallest and places it at the start. Both repeat until sorted.
Array Memory Layout:
Index: 0 1 2 3
+----+----+----+----+
Value: | 4 | 2 | 5 | 1 |
+----+----+----+----+
During sorting, values swap places in these boxes.
Bubble Sort pushes largest values to the right step by step.
Selection Sort picks smallest values and places them at the left step by step.