Insertion Sort

Builds the sorted array one element at a time by shifting greater elements to the right and inserting the key.

Category Easy Stable In-Place Avg: O(n log n) Space: O(1)
Switch Algorithm

Input Configuration & Pattern Laboratory

Test this algorithm against custom arrays or common algorithmic edge case patterns.

Input Patterns:
Array Elements Visualization
Unprocessed
Comparing
Swap / Write
Pivot / Special
Sorted
Auxiliary
Step 0 / 0
Comparisons 0
Swaps 0
Array Writes 0
Measured Runtime 0.00 ms
READY

INITIAL STATE

Step 0 of 0

Press Play or Next Step to begin visualization.

The array is currently in its initial input state.

Theoretical Complexity Analysis Asymptotic Big-O Properties
Best-Case Time O(n)
Average-Case Time O(n²)
Worst-Case Time O(n²)
Auxiliary Space O(1)
Stability Yes
In-Place Yes
Adaptive Yes

Algorithmic Reference & Implementation Guide

Complete theoretical study material, pseudocode, verified Java reference, and interview question preparation.