This document provides an overview of insertion sort, including:
- How insertion sort works by dividing an array into sorted and unsorted parts, inserting unsorted elements into the sorted part in each pass.
- The algorithm scans the array from left to right, inserting each element into the correct position in the previously sorted subarray.
- Runtime is O(n^2) in the worst and average cases due to multiple comparisons and shifts that may be required.
- Pseudocode and Java code examples are provided to demonstrate implementation.
- Advantages are simplicity and efficiency for small datasets, while disadvantages include poor performance for large arrays compared to other algorithms.