Chapter 3 · SimulationSorting Algorithms? ← Chapter 3 Bubble sortInsertion sortSelection sort Merge sortQuick sortCounting sort Radix sortBucket sortHeap sortShell sort SlowNormalFast New Array Sort CancelReady.Step: 0valuecompared / movedsorted CloseSorting AlgorithmsPick an algorithm, press Sort and watch 16 random values (10–99) get sorted. Highlighted bars are the items being compared or moved at that moment; when the run finishes, all bars turn green. New Array generates new values, Cancel stops a running sort, and the speed menu sets the pause between steps.Bubble sortCompares neighbouring items and swaps them if they are out of order. Each pass moves the largest remaining value to the end.Insertion sortTakes the next item and moves it left through the sorted prefix until it reaches its place. Efficient on small or nearly sorted inputs.Selection sortFinds the smallest item in the remaining part and swaps it into the next position of the sorted prefix.Merge sortRecursively splits the list in two, then merges the sorted halves back together.Quick sortChooses a pivot and partitions the values around it; then sorts the left and right parts recursively.Counting sortCounts how many times each value occurs and rebuilds the sorted output from those counts.Radix sortProcesses the numbers digit by digit, applying a stable counting step for each digit value.Bucket sortDistributes the values into buckets by value range, sorts each bucket and concatenates the results.Heap sortBuilds a max-heap; then repeatedly moves the root to the end and restores the heap property.Shell sortMakes insertion-sort-like passes with shrinking gaps; the last pass is an ordinary insertion sort with gap 1.ComplexityAlgorithmBestAverageWorstExtra memoryBubbleO(n)O(n²)O(n²)O(1)InsertionO(n)O(n²)O(n²)O(1)SelectionO(n²)O(n²)O(n²)O(1)MergeO(n log n)O(n log n)O(n log n)O(n)QuickO(n log n)O(n log n)O(n²)O(log n) avg.CountingO(n+k)O(n+k)O(n+k)O(n+k)RadixO(d(n+k))O(d(n+k))O(d(n+k))O(n+k)BucketO(n+k)O(n+k)O(n²)O(n+k)Heap sortO(n log n)O(n log n)O(n log n)O(1)Shelldepends on gapsdepends on gapsO(n²)O(1)The O(n) best case of bubble sort applies to the version with an early exit that stops after a pass without swaps; the animation runs the plain version.