01
The question
Bubble Sort is usually introduced through its quadratic behavior. But an implementation that stops after a pass with no swaps has a different best case. This educational experiment compares shuffled, already-sorted, and reversed inputs while keeping the implementation and measurement boundaries explicit.
02
Experiment design
- Use the same copying Bubble Sort implementation with synthetic paired inputs and stable provenance checks.
- Retain exact saved inputs, original timing and calibration records, and analysis settings.
- Summarize measurements by input and regenerate the article table and figure.
- Provide correctness tests, input-regeneration checks, manifests, and a portable Bubble-only rerun driver.
03
What the measurements show
At 2,000 values, the first recorded dataset reports rounded median times of 112.7 ms for shuffled input, 0.06917 ms for sorted input, and 140.6 ms for reversed input. These are recorded observations, not expected timings on every machine.
Sorted inputs of n >= 2 values need n-1 comparisons in this implementation; descending distinct inputs need n(n-1)/2. Comparison counts do not directly predict elapsed-time ratios because swaps, copying, and interpreter costs also matter.
04
Reproducibility and limits
The original observations were interleaved with four other sorting methods. The Bubble-only driver reproduces the implementation, exact input values, and timing rules, but does not reconstruct that cross-method schedule. The cover's six-item examples are illustrations, not the benchmark inputs. This is a published technical article and educational experiment, not a peer-reviewed novelty claim.
Explore the work
Source code, documentation, and reproducibility notes on GitHub
Published companion article on Medium
