# Binary Insertion Sorter Algorithm

However, insertion sort provides several advantages:
1. Simple implementation: Jon Bentley shows a three-line c version, and a five-line optimized version
Efficient for (quite) small data sets, much like other quadratic sorting algorithmsAdaptive, i.e., efficient for data sets that are already substantially sorted: the time complexity is O(kn) when each component in the input is no more than K places away from its sorted position
2. Stable; i.e., makes not change the relative order of components with equal keys

### Binary Insertion Sorter source code, pseudocode and analysis

To perform an insertion sort, begin at the left-most component of the array and invoke insert to insert each component encountered into its correct position. It operates by beginning at the end of the sequence and shifting each component one place to the right until a suitable position is found for the new component.