Notes / tag / arrays-strings

#arrays-strings

8 notes

# Data Structures Algorithms

All Data Structures Algorithms notes →

1 — Arrays

Static vs. dynamic arrays, why contiguous memory buys O(1) random access, row-major layout for multi-dimensional arrays, the complexity of every core operation, and where list, array, and numpy diverge.

data-structures-algorithms arrays-strings book
Jul 27, 2026

2 — Array Algorithms

In-place rotation via the reversal trick, Kadane's maximum subarray, Dutch National Flag partitioning, merging sorted arrays in place, and the sum/XOR tricks for a missing or duplicate number.

data-structures-algorithms arrays-strings book
Jul 27, 2026

3 — Two Pointers

Opposite-direction and same-direction pointer techniques for sorted arrays — Two Sum II, Container With Most Water, 3Sum, and in-place duplicate removal — plus how to tell the pattern apart from sliding window.

data-structures-algorithms arrays-strings book
Jul 27, 2026

4 — Sliding Window

Fixed vs. variable window, when to grow or shrink, and the substring/subarray problems this technique solves in linear time.

data-structures-algorithms arrays-strings book
Jul 27, 2026

5 — Prefix Sum & Difference Arrays

Precomputed running sums and difference arrays for O(1) range-sum queries and range-update problems.

data-structures-algorithms arrays-strings book
Jul 27, 2026

6 — Hashing

How Python's dict/set turn an O(n) or O(n²) scan into O(1) average-case lookups, when that average case breaks down, and where hashing trades away information — order — that a problem still needs.

data-structures-algorithms arrays-strings book
Jul 27, 2026

7 — Strings

Why treating a Python string as 'just an array of characters' is only half true — immutability turns naive concatenation quietly quadratic, and that one property shapes every string algorithm that follows.

data-structures-algorithms arrays-strings book
Jul 27, 2026

8 — String Algorithms

Palindrome checks via two pointers and expand-around-center, anagram detection by counting vs. sorting, the naive O(n·m) substring search baseline, and why Python's string immutability turns 'reverse in place' into a trick question.

data-structures-algorithms arrays-strings book
Jul 27, 2026