मुख्य कंटेंट तक स्किप करें

4 docs tagged with "range-query"

सारे टैग देखें

2D Prefix Sum

Extend the Prefix Sum technique to two dimensions — efficiently answer rectangular range sum queries on a 2D grid in O(1) after O(m×n) preprocessing. Includes intuition, dry runs, and multi-language implementations.

Mo's Algorithm

Learn Mo's Algorithm for offline range queries with block decomposition, dry runs, complexity analysis, and implementations in C++, Java, Python, and JavaScript.

Prefix Sum Algorithm

Learn the Prefix Sum technique — a powerful range-query optimization that answers range sum queries in O(1) after O(n) preprocessing. Includes dry runs, complexity analysis, common mistakes, and multi-language implementations.

Segment Tree

A comprehensive guide to Segment Trees with visual diagrams, build/query/update operations, lazy propagation, code templates in Python, Java, and C++, and practice problems.