Data Structures & AlgorithmsHardCodeforces Div2 D · data structures

Problem: What is the purpose of the 'sqrt decomposition' technique for an array?

  1. A. Answering range queries and point updates in O(sqrt n) each
  2. B. Sorting in O(1)
  3. C. Finding the median in O(1)
  4. D. Computing shortest paths

Correct answer: A. Answering range queries and point updates in O(sqrt n) each

Blocks of size sqrt(n) store aggregates, so updates and queries touch O(sqrt n) pieces.

More Coding Interview Problems questions

Exams that ask this topic