LeetCode 147: Insertion Sort List
Sort a singly linked list using insertion sort by splicing each node into a growing sorted list.
8 notes
Sort a singly linked list using insertion sort by splicing each node into a growing sorted list.
Optimize insertion sort by placing the minimum element at the front so the inner loop does not need a bounds check.
Sort an almost ordered sequence efficiently by using insertion sort, whose running time improves when few elements are far from their final positions.
Sort a sequence as elements arrive by inserting each new item into its correct position among the items already seen.
An insertion-based sorting algorithm that leaves gaps between elements to reduce shifting.
Insertion sort that uses binary search to find the insertion position, reducing comparisons.
Build a sorted sequence by inserting each element into its correct position.
Build a sorted prefix one element at a time by inserting each new element into its correct position within the already-sorted portion.