Tag
#arrays
4 articles tagged arrays.
Binary Search: Halving a Sorted World Down to One Answer
A diagram-first guide to the binary search algorithm: the lo/hi/mid loop, avoiding overflow, lower and upper bound, binary search on the answer, O(log n) time complexity, and interview prep.
Sliding Window: Turning O(n²) Subarray Scans Into One Clean Pass
The sliding window algorithm explained: fixed and variable windows, the two-pointer technique, amortized O(n) time complexity, and interview code for max subarray sum and longest substring.
Sorting Algorithms: Merge Sort, Quicksort, and Why a Bad Pivot Costs You O(n²)
A diagram-first guide to sorting algorithms: insertion sort, merge sort, quicksort partition and pivot, heap sort, stability, the O(n log n) lower bound, time complexity, and interview prep.
Two Pointers: Turning an O(n²) Pair Hunt Into a Single O(n) Walk
The two pointers algorithm explained: converging and fast/slow pointers, two-sum on a sorted array, valid palindrome, container with most water, O(n) time complexity, and interview prep.