Merge Sort Visualizer
Divide-and-conquer algorithm that recursively splits arrays into singletons and merges sorted runs in O(N log N) time.
O(N log N) Time, O(N) Space (Stable)Watch Merge Sort, Quick Sort, Heap Sort, Bubble Sort, Insertion Sort, and Selection Sort rearrange arrays step by step with real-time operation counters.
Divide-and-conquer algorithm that recursively splits arrays into singletons and merges sorted runs in O(N log N) time.
O(N log N) Time, O(N) Space (Stable)In-place partitioning around a chosen pivot element (Lomuto / Hoare schemes) with recursive subarray partitioning.
Avg O(N log N), Worst O(N²)Constructs a binary Max-Heap from the unsorted array and repeatedly extracts the root maximum element.
O(N log N) Time, O(1) Space (In-Place)Builds the final sorted array one item at a time by shifting elements into their proper position in the sorted prefix.
Best O(N), Worst O(N²) (Adaptive & Stable)Repeatedly finds the minimum element from the unsorted sublist and swaps it to the front of the array.
O(N²) Comparisons, O(N) SwapsSimple comparison algorithm that steps through the list, compares adjacent elements, and swaps them if in the wrong order.
O(N²) Time, O(1) Space (Stable)Step forward and backward through individual array comparisons and swaps at your own pace.
Track exact comparison and array write counts in real time alongside Big-O theoretical curves.
Conforms to AP Computer Science A, CBSE CS Class 12, and technical coding interview benchmarks.
Follow this standardized experimental methodology to configure parameters, simulate processes, and record scientific telemetry.
Choose between elementary O(N²) algorithms or efficient O(N log N) divide-and-conquer sorts.
Select random integers, nearly sorted arrays, reversed sequences, or arrays containing identical duplicates.
Observe active comparison pointers, pivot indices, and subarray partitions highlighted in real time.
Track the exact number of comparisons, memory allocations, and array writes against Big-O expectations.
Decision tree theoretical limits and array mutation state machines evaluated in real time.
Our sorting visualizers cover all algorithms specified in CBSE Computer Science Class 12, AP Computer Science A (Unit 7: Searching and Sorting), and undergraduate CS algorithms courses.
Interactive color-coded array bars make stability, adaptiveness, and space complexities immediately intuitive.
Count comparisons, swaps, and recursive stack depths in real time.
Technical and curriculum details about sorting algorithms.
A sorting algorithm is stable if it preserves the relative order of elements with equal keys in the output. Merge Sort, Insertion Sort, and Bubble Sort are stable; Quick Sort and Heap Sort are inherently unstable in their standard in-place forms.
Heap Sort encodes the binary tree directly inside the existing array indices (children at 2i+1 and 2i+2), requiring no auxiliary storage. Merge Sort merges two sorted halves into a separate auxiliary array to prevent overwriting unmerged elements.
Insertion Sort runs in linear O(N) time on nearly sorted arrays with very low overhead, outperforming even Quick Sort and Merge Sort for this specific distribution.
Yes. All sorting simulations and comparisons are 100% free and open for educational use.