Chapter 3 · SimulationSorting Race? ← Chapter 3 Size Speed SlowNormalFast New Array Start RaceCloseSorting RaceRun several sorting algorithms on the same array and compare their progress, number of comparisons and number of swaps/moves.How to useChoose an array size (8–40) and press New Array to generate random values between 10 and 99.Press Start Race. Each lane takes one basic step per tick, so the finishing order reflects how many steps each algorithm needs on this input.Speed changes the tick length; pressing Start Race again restarts the race on the same array.AlgorithmsAlgorithmBestAverageWorstNotesBubble sortO(n²)*O(n²)O(n²)Adjacent swaps; stableInsertion sortO(n)O(n²)O(n²)Shifts items; stable, fast on nearly sorted dataSelection sortO(n²)O(n²)O(n²)At most n − 1 swaps; not stableQuick sortO(n log n)O(n log n)O(n²)Lomuto partition, last element as pivot* This bubble sort has no early-exit flag, so it always makes n(n − 1)/2 comparisons.In insertion sort, “moves” counts item shifts; in the other algorithms it counts swaps.