Visualize Insertion Sort step by step. See how each element is picked from the unsorted region and inserted into its correct position in the sorted prefix, like arranging playing cards.
Insertion Sort builds the final sorted array one item at a time, inserting each element into its correct position.
Assume the first element is already sorted.
Pick the next element and compare it with elements in the sorted sub-array.
Shift all sorted elements that are larger to the right, then insert the picked element at its correct position.
Repeat until all elements are inserted into the sorted sub-array.
Insertion Sort is efficient for small data sets and works well for nearly-sorted arrays.