← Back to Gallery

Gravity Sort

Gravity Passes:0
Beads Moved:0
Total Beads:0
Status:Ready

Gravity (Bead) Sort

Represent each number as a row of beads on an abacus. Let gravity pull beads down. After settling, reading rows bottom-to-top gives the sorted array. Like a physical sorting machine!

Worst:   O(n × max_val)
Average: O(S) where S = sum
Best:    O(1) with hardware
Space:   O(n × max_val)

Only works for positive integers. Beautiful but impractical without hardware.