Concepts7

๐Ÿ—‚๏ธ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
โš™๏ธAlgorithmAdvanced

Sqrt Decomposition on Queries

Sqrt decomposition on queries (time blocking) processes Q operations in blocks of size about \(\sqrt{Q}\) to balance per-query overhead and rebuild cost.

#sqrt decomposition#time blocking#query blocking+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 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 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