Skip to main content

17 docs tagged with "patterns"

View all tags

Backtracking

Backtracking searches a space of candidate solutions by building them one choice at a time, and

Divide & Conquer

Divide and conquer breaks a problem into independent subproblems of the same kind, solves those

Dynamic Programming

Dynamic programming applies when a problem has overlapping subproblems — the same sub-computation

Fast & Slow Pointers

A singly-linked list, or anything shaped like one — a permutation's i -> p[i] mapping, a

Greedy Algorithms

A greedy algorithm makes the choice that looks best right now and never reconsiders it. When that

Intervals & Sweep Line

A calendar full of meetings, a set of (start, end) ranges to merge, a question like "how many

Monotonic Stack & Queue

"For each element, find the nearest element to the right that is bigger" looks like it needs a nested

Parallel Patterns

Almost every GPU kernel, however specialized, is built from a small set of recurring data-access shapes. Recognizing which pattern a problem is — before writing any code — tells you how parallelizable it is, what its likely performance limiter will be, and often points directly at a library implementation that already exists and is already tuned. This page names those shapes once, and every later applied-kernel page in this knowledge base assumes you already know these names — "this is a reduction" or "this needs a scan" is meant to carry full meaning by the time you reach folder 13.

Pattern flags

The pattern controls the line around your message — timestamp, level, logger name, thread id — and

Top-K & Streaming

"Find the k largest" looks like a sorting problem, and sorting solves it — but sorting also computes