
Cartesian Tree: O(n) Build, O(1) Range Queries, Zero Rotations
The Cartesian tree satisfies BST-on-indices and heap-on-values. Build it in O(n) with a monotone stack, then answer range minimum queries via LCA.
Page 44 of 61 · Ideas for curious minds in tech.
Back to the archive
The Cartesian tree satisfies BST-on-indices and heap-on-values. Build it in O(n) with a monotone stack, then answer range minimum queries via LCA.

The quadtree data structure recursively partitions 2D space for O(√n + k) range queries. 14 language implementations, complexity proofs, and real-world use cases.

The radix tree data structure compresses tries to O(n) nodes. Learn the edge-split algorithm, 2n-1 node proof, and 14 language implementations.

Red-black tree explained: the 5 invariants, O(log n) worst-case height proof, insert and delete rotation bounds, and 14 language implementations.

How the persistent segment tree uses path copying to keep every update version, answer range queries in O(log n), and solve k-th smallest in subarray problems.

How the AVL tree's balance factor invariant, four rotation cases, and Fibonacci height proof guarantee O(log n) for every operation, worst-case.

Amortized, average case, and worst case time complexity are different contracts. Learn when each applies and why mixing them up costs you in interviews.

O(log n) time complexity appears in binary search, heaps, merge sort, and balanced trees. Learn why halving at each step always produces logarithmic depth.

Pass by value vs reference in Python, Java, Go, and C++. Why backtracking returns empty lists, and the three aliasing bugs behind it.

The time-space tradeoff explained: precomputation, memoization, and hashing. Learn when storing more data makes algorithms faster in interviews.

Integer overflow coding interview bugs don't crash your program. They silently return wrong answers. Here's where they hide and how to catch them.

A stable sort preserves the relative order of equal-key elements. Here's why it matters for multi-key sorting, radix sort, and coding interviews.

How hash functions work: polynomial rolling hash, collision strategies, load factor, amortized resizing, and why O(1) lookup is a theorem, not a hope.

An in-place algorithm uses O(1) auxiliary space. Recursion stacks count. Learn the strict definition, sorting comparisons, and how to answer in interviews.

The difference between Big-O, Theta, and Omega explained with quicksort, merge sort, and the comparison sort lower bound. For coding interviews.

Amortized analysis explained with the aggregate, accounting, and potential methods. Learn why dynamic array append is truly O(1) amortized.

Learn when and how to convert recursion to iteration using accumulators and explicit stacks. Covers Python recursion limits, tail calls, and DFS.

Memoization vs tabulation: same asymptotic complexity, different tradeoffs. Learn when rolling arrays force you to switch from top-down to bottom-up DP.

Educative.io review 2026: honest take on pricing (after discounts), the Grokking series, where it falls short, and when to use something else.

A full interviewing.io review for 2026: what expert sessions cost, feedback quality, who gets their money's worth, and what to use instead.

NeetCode review: what it does well, where it stops, and why pairing it with voice mock interviews closes the gap between prep and real interviews.

LeetCode vs SpaceComplexity: LeetCode builds your pattern library, SpaceComplexity trains the spoken performance. Here's how to use both.

HackerRank vs SpaceComplexity: one trains you for automated screening tests, the other for live interviews. Here's when to use each.

Exponent vs SpaceComplexity: an honest breakdown of two coding interview prep platforms, what each does best, and which one software engineers should use.