Data Structures19 sections · 729 units
Open in Course

MO's with Updates - Analysis

Why n^(5/3)?

With block size B=n2/3B = n^{2/3}: ll-pointer: moves O(B)O(B) per query = O(qn2/3)O(qn^{2/3}) rr-pointer: for each ll-block, rr sweeps the full rr-range once, so O(n)O(n) per ll-block. With n1/3n^{1/3} ll-blocks, total = O(nn1/3)=O(n4/3)O(n \cdot n^{1/3}) = O(n^{4/3}) tt-pointer: moves O(n)O(n) per (l,r)(l,r)-block pair, (n/B)2(n/B)^2 pairs = O(nn2/3)=O(n5/3)O(n \cdot n^{2/3}) = O(n^{5/3})

Total: O(n5/3+qn2/3)O(n^{5/3} + qn^{2/3}). For qnq \approx n, the complexity is O(n5/3)O(n^{5/3}).