The phenomenon
What you’re seeing
Put classic sorting strategies through the same random array and compare their operations. Drag the controls to investigate how the system changes, then pause to inspect the current state.
Put classic sorting strategies through the same random array and compare their operations.
Put classic sorting strategies through the same random array and compare their operations. Drag the controls to investigate how the system changes, then pause to inspect the current state.
Bubble, insertion and selection sorts have different comparison and swap patterns, even though their average work is often O(n²).