The symmetric group: every way of shuffling a set, treated as algebra
Take a handful of objects and list every possible rearrangement. Treat each rearrangement as an action you can perform one after another, and you have the symmetric group. It sounds modest, yet every group in mathematics can be found hiding inside one, and bubble sort quietly relies on its structure.
The elements are permutations, and combining two means doing one and then the other. That satisfies all the rules a group needs: composing shuffles gives another shuffle, the order of grouping does not matter, leaving everything in place acts as an identity, and every shuffle can be undone. Cayley's theorem says any group whatsoever is equivalent to some collection of permutations inside a symmetric group, which is why these groups are such a universal model.
Every shuffle can be built from swaps of just two elements, called transpositions. You can do this in many ways, but the number of swaps needed is always even or always odd for a given permutation, giving it a sign. The even permutations form their own subgroup, the alternating group, containing exactly half the elements. Restricting to swaps of neighbouring positions still works, and that is exactly what bubble sort does when it trades adjacent items until a list is in order.
Another way to picture a permutation is as cycles, loops in which each element moves to the next position. Any permutation breaks uniquely into non-overlapping cycles, and cycles that share no elements can be applied in either order with the same result.
The group reaches far beyond puzzles about ordering. It is the Galois group of the general polynomial, which makes it central to the Abel–Ruffini theorem showing that some polynomial equations cannot be solved using roots and ordinary arithmetic. It also appears in invariant theory, where functions unchanged by reordering their variables are called symmetric functions, and in combinatorics through Young tableaux.
Source: Symmetric group