Data Structures & AlgorithmsHardCodeforces Div2 D · data structures
Problem: What is the purpose of the 'sqrt decomposition' technique for an array?
- A. Answering range queries and point updates in O(sqrt n) each
- B. Sorting in O(1)
- C. Finding the median in O(1)
- 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
- Problem: Which statement about the 'Chinese remainder theorem' is correct for non-coprime moduli?
- Problem: What is the complexity of computing the Euler totient for all numbers up to n with a linear sieve?
- Problem: Which technique computes the sum of a function over all subsets of a set of size n in O(n 2^n)?
- Problem: What does the cross product of two 2D vectors (a, b) and (c, d) equal?
- Problem: Which approach finds the k-th lexicographically smallest substring of a string?
- Problem: What is the expected number of distinct values when n balls are thrown uniformly into n bins?