Watch comparison-based sorting algorithms rearrange an array. Yellow = comparing, pink = swapping, green = in final place.
Numbers are randomised each time you click New array (or change the size). The same algorithm runs every comparison and swap step-by-step — try Step for one operation at a time.