Data Structures & AlgorithmsVery hardICPC regional · offline queries
Problem: What is the time complexity of the 'Mo's algorithm with updates' (time dimension added) in terms of n and q?
- A. O(n log n)
- B. O(n^2)
- C. O(n^(5/3))
- D. O(q)
Correct answer: C. O(n^(5/3))
Adding a time dimension to Mo's algorithm balances block sizes to about n^(2/3), giving O(n^(5/3)) total.
More Coding Interview Problems questions
- Problem: Which problem asks for the length of the shortest cycle in an undirected unweighted graph?
- Problem: Which theorem guarantees a perfect matching in a bipartite graph when Hall's condition holds for the smaller side?
- Problem: What is the main idea of the 'parallel binary search' technique?
- Problem: Which structure gives fast membership tests of substrings after O(n) construction (for a fixed alphabet)?
- Problem: What is the expected number of rounds of a randomised min-cut (Karger's algorithm) needed for a graph with n vertices to find a…
- Problem: What does the term 'amortised analysis' mean?