Concepts11

๐Ÿ—‚๏ธData StructureAdvanced

Segment Tree with Range Affine Transformation

A segment tree with lazy propagation can support range updates of the form x โ†’ aยทx + b (affine transformations) and range-sum queries in O(log n) per operation.

#segment tree#lazy propagation#affine update+12
๐Ÿ—‚๏ธData StructureAdvanced

HLD - Path Queries and Updates

Heavy-Light Decomposition (HLD) breaks a tree into a small number of vertical chains so any path (u,v) becomes O(log n) contiguous segments in an array.

#heavy light decomposition#hld#path query+12
๐Ÿ—‚๏ธData StructureAdvanced

Implicit Treap

An implicit treap is a randomized balanced binary tree that treats array positions as keys without storing them explicitly.

#implicit treap#treap#split and merge+11
๐Ÿ—‚๏ธData StructureAdvanced

Treap

A treap is a binary search tree on keys combined with a heap on random priorities, which keeps the tree balanced in expectation.

#treap#randomized bst#fhq treap+12
๐Ÿ—‚๏ธData StructureIntermediate

Sqrt Decomposition

Sqrt decomposition partitions an array into about \(\sqrt{n}\) blocks, each of size about \(\sqrt{n}\), to speed up range queries and updates.

#sqrt decomposition#block decomposition#bucket decomposition+11
๐Ÿ—‚๏ธData StructureIntermediate

Iterative Segment Tree

An iterative segment tree stores all leaves in tree[n..2n-1] and internal nodes in tree[1..n-1], enabling O(\log n) point updates and range queries without recursion.

#iterative segment tree#segment tree#non-recursive+12
๐Ÿ—‚๏ธData StructureAdvanced

Segment Tree - Handling Multiple Lazy Operations

When a segment tree supports multiple range updates, you must define how lazy tags compose, because the order of operations matters and composition is not commutative.

#segment tree#lazy propagation#range add+12
๐Ÿ—‚๏ธData StructureIntermediate

Segment Tree with Lazy Propagation

A segment tree with lazy propagation supports fast range updates and range queries in O(\log n) time.

#segment tree#lazy propagation#range update+12
๐Ÿ—‚๏ธData StructureAdvanced

Dynamic Segment Tree

A dynamic segment tree stores values over a huge coordinate range by creating nodes only when an operation touches their interval.

#dynamic segment tree#sparse segment tree#lazy propagation+12
๐Ÿ—‚๏ธData StructureIntermediate

Segment Tree Basics

A segment tree is a complete binary tree that stores information about array intervals to answer range queries and support point updates in O(log n).

#segment tree#range query#point update+11
๐Ÿ—‚๏ธData StructureIntermediate

Fenwick Tree - Range Update Range Query

A Fenwick Tree (Binary Indexed Tree) can support range additions and range sum queries by maintaining two trees, often called B1 and B2.

#fenwick tree#binary indexed tree#range add+12