NOTE

Bubble Sort

Adjacent-swap sorting with quadratic time and mainly educational value.

Data Structures & AlgorithmsCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

Bubble sort repeatedly compares adjacent elements and swaps out-of-order pairs, moving an extreme element toward one end each pass.

Its average/worst time is O(n^2) and it is generally not appropriate for large real workloads. With the usual implementation it can be stable and in-place.

Its main value is educational: it illustrates inversion removal and simple loop invariants.

Loading helpful count