Data Structures & Algorithms

Fundamentals

These are the habits and small techniques that decide whether a problem is a quick implementation or an unnecessary detour.

9 published notes
3 planned topics
0 advanced or expert notes
basic starting level

Fundamentals

Core patterns that show up before the heavy machinery does.

Overview

This category is about the habits that make bigger techniques usable: complexity estimates, pointer movement, binary search patterns, small preprocessing tricks, and the ability to compress a problem before reaching for heavier machinery.

Why It Matters

A large fraction of contest mistakes do not come from not knowing an advanced data structure. They come from using the right high-level idea on top of a weak foundation: an off-by-one binary search, an unnecessary logarithm, or a missing compression step that makes the rest of the solution impossible.

How this branch is distributed

The labels are not cosmetic. They are there to signal the amount of prerequisite structure and implementation fragility you should expect before opening the note.

basic: 5 intermediate: 4 advanced: 0 expert: 0
5 basic
basic

These are the shortest on-ramp notes in this category and the ones most likely to be usable immediately in contest practice.

Binary Search, Prefix Sums and Difference Arrays, Two Pointers and Sliding Window, Sorting and Events, Coordinate Compression

4 intermediate
intermediate

These notes assume the base routine is already familiar and focus on the first real structural upgrades.

Ternary Search, Bitmask Techniques, Greedy Exchange Argument, Meet-in-the-Middle

What is already written

These are the finished note pages in this category, each with rendered TeX, C++ code, references, and practice suggestions.

01
basic

Binary Search

A decision-to-answer pattern for monotone predicates, answer-space search, and continuous approximation.

monotone predicate answer search / invariants
02
intermediate

Ternary Search

Optimize a unimodal function on a discrete or continuous domain by keeping the side that still contains the optimum.

optimization unimodal / search
03
basic

Prefix Sums and Difference Arrays

Turn repeated range work into constant-time queries or constant-time lazy marks by changing what the array stores.

preprocessing range queries / range updates
04
basic

Two Pointers and Sliding Window

Exploit one-way pointer movement to turn many quadratic scans into linear passes over arrays and strings.

window techniques linear scan / invariants
05
basic

Sorting and Events

Turn interval and query problems into a left-to-right sweep over sorted add, remove, and inspect events.

sweep line offline / intervals
06
intermediate

Bitmask Techniques

Compact subset state, fast bit operations, and the enumeration patterns that power many small-state solutions.

subset state bit operations / enumeration
07
intermediate

Greedy Exchange Argument

A proof pattern for showing that one locally optimal choice can be forced into some global optimum without making the solution worse.

greedy proof / exchange
08
basic

Coordinate Compression

Replace large or sparse values by their rank order so array-based structures become practical again.

preprocessing indexing / offline
09
intermediate

Meet-in-the-Middle

Split an exponential search into two smaller exponential searches and join the halves with sorting or hashing.

complete search subset sums / half enumeration

Recommended order to read this branch

The default order follows each note's dependency weight: early notes establish primitives, later notes reuse them or assume the same invariants without re-explaining them.

01
basic

Binary Search

A decision-to-answer pattern for monotone predicates, answer-space search, and continuous approximation.

monotone predicate answer search / invariants
02
intermediate

Ternary Search

Optimize a unimodal function on a discrete or continuous domain by keeping the side that still contains the optimum.

optimization unimodal / search
03
basic

Prefix Sums and Difference Arrays

Turn repeated range work into constant-time queries or constant-time lazy marks by changing what the array stores.

preprocessing range queries / range updates
04
basic

Two Pointers and Sliding Window

Exploit one-way pointer movement to turn many quadratic scans into linear passes over arrays and strings.

window techniques linear scan / invariants
05
basic

Sorting and Events

Turn interval and query problems into a left-to-right sweep over sorted add, remove, and inspect events.

sweep line offline / intervals
06
intermediate

Bitmask Techniques

Compact subset state, fast bit operations, and the enumeration patterns that power many small-state solutions.

subset state bit operations / enumeration
07
intermediate

Greedy Exchange Argument

A proof pattern for showing that one locally optimal choice can be forced into some global optimum without making the solution worse.

greedy proof / exchange
08
basic

Coordinate Compression

Replace large or sparse values by their rank order so array-based structures become practical again.

preprocessing indexing / offline
09
intermediate

Meet-in-the-Middle

Split an exponential search into two smaller exponential searches and join the halves with sorting or hashing.

complete search subset sums / half enumeration

Next topics in this branch

These are still intentionally shown as planned or outline topics rather than shallow filler. The branch should feel incomplete in honest places instead of fake-complete everywhere.

Complexity analysis planned Sorting planned Sweep line basics outline

Source Files and Assets

Raw files are still available here when you want the original TeX, C++, or statement assets.

Show raw files