Concepts204

⚙️AlgorithmIntermediate

Prefix Sum and Difference Array

Prefix sums precompute running totals so any range sum [l, r] can be answered in O(1) time as prefix[r] - prefix[l-1].

#prefix sum#difference array#imos method+12
⚙️AlgorithmIntermediate

Coordinate Compression

Coordinate compression replaces large, sparse, or arbitrary values with small consecutive integers while preserving relative order.

#coordinate compression#discretization#lower_bound+12
⚙️AlgorithmIntermediate

Complete Search and Backtracking

Complete search enumerates every candidate solution, while backtracking prunes branches that cannot possibly lead to a valid or better solution.

#complete search#backtracking#recursion+12
⚙️AlgorithmIntermediate

Sorting Algorithms

Sorting arranges items into a chosen order so that searching, grouping, and further algorithms become faster and simpler.

#sorting algorithms#merge sort#quicksort+12
⚙️AlgorithmIntermediate

Greedy - Exchange Argument

The exchange argument proves a greedy algorithm is optimal by swapping out-of-order choices in any supposed optimal solution until it matches the greedy one without making it worse.

#greedy#exchange argument#pairwise swap+12
⚙️AlgorithmIntermediate

Greedy Algorithms

Greedy algorithms build a solution step by step by always taking the best local choice available.

#greedy algorithms#activity selection#interval scheduling+12
⚙️AlgorithmIntermediate

Sliding Window

Sliding window is a technique that moves a contiguous segment (window) across an array or string while maintaining some running information like sum, count, or max.

#sliding window#two pointers#variable window+11
⚙️AlgorithmIntermediate

Ternary Search

Ternary search finds the maximum or minimum of a unimodal function on a line by probing two interior points and discarding one third of the interval each step.

#ternary search#unimodal function#convex optimization+12
⚙️AlgorithmIntermediate

Binary Search on Answer

Binary Search on Answer turns an optimization problem into a yes/no decision problem over a monotonic answer space.

#binary search on answer#parametric search#monotonic predicate+12
⚙️AlgorithmIntermediate

Two Pointers

Two pointers is a pattern where two indices move through a sequence in a coordinated, usually monotonic way to avoid unnecessary work.

#two pointers#sliding window#opposite ends+12
⚙️AlgorithmIntermediate

Binary Search

Binary search quickly finds targets or boundaries in sorted or monotonic data by halving the search interval each step.

#binary search#lower_bound#upper_bound+11
🗂️Data StructureIntermediate

Merge Sort Tree

A Merge Sort Tree is a segment tree where every node stores the sorted list of values in its segment.

#merge sort tree#segment tree#range query+12