Insertion Sort Visualization
Builds the sorted array one item at a time, picking the next element and inserting it into the correct position.
Step: 0 / -1
Speed
Pseudocode
1for i = 1 to n-1
2 key = arr[i]
3 j = i - 1
4 while j >= 0 and arr[j] > key
5 arr[j+1] = arr[j]
6 j = j - 1
7 arr[j+1] = key
Time Complexity
Best CaseO(n)
Average CaseO(n²)
Worst CaseO(n²)