Citation:
Insertion sort is a simple and intuitive comparison-based sorting algorithm that builds a sorted array one element at a time by repeatedly taking an element from the unsorted section and inserting it into the correct position in the sorted section. This method allows for efficient sorting of small datasets, and it works by dividing the input into a sorted and an unsorted part, gradually growing the sorted portion until all elements are sorted.