29 Insertion sort Easy Shift & Place

Sort a list by repeatedly picking the next element and inserting it into its correct spot.

O(n^2) time · O(1) space · Stable
30 Merge sort Medium Divide & Merge

Sort a list by splitting it in half, sorting each half, and merging them back together.

O(n log n) time · O(n) space · Stable
31 Quick sort (Lomuto partition) Medium Partition

Sort a list by picking a pivot, putting smaller elements left and larger right, then recursing.

O(n log n) avg · O(n^2) worst · O(log n) space
32 Merge two sorted arrays Easy Two Pointers

Combine two sorted arrays into one — the merge step that powers merge sort.

O(n+m) time · O(n+m) space
33 Dutch national flag (3-way partition) Medium lo/mid/hi Pointers

Sort an array containing only 0s, 1s, and 2s in a single pass.

O(n) time · O(1) space