Searching and Sorting
Searching and sorting are the most fundamental algorithmic patterns. This section covers the major search and sort algorithms — each in its own post with worked examples, traced iteration tables, and complete code.
What's in this section
- Introduction to recursion — the pattern that powers divide-and-conquer
- Linear search — the simplest search, with the sentinel optimization
- Binary search — logarithmic search on sorted arrays
- Interpolation search — binary search with a smarter midpoint
- Bubble sort — repeated swapping
- Selection sort — selecting the minimum
- Insertion sort — building the sorted portion incrementally
- Merge sort — divide, conquer, combine
- Quick sort — partition-based sorting
- Counting sort — linear time when the range is small
- Radix sort — digit-by-digit sorting