195. Segment tree methods document O(log |D|) (2026-11-22)
- Decision. Every method of
SegTree,LazySegTreeandDualSegTreestates its cost over the tree's domain: building costsO(|D|), andapply,fold,update,refresh,max_right,min_leftand the rest costO(log |D|). Calls to the tree's own operation, action orokcount as one step each, as an operator does (29.46). - Why.
applyandfoldstated no cost and the others saidO(n)orO(log n)without saying whatnis, so a fn calling them had no estimate. Fns incorpus/problemsand the examples with an estimate: 26 to 27 of 1,613;applyno longer blocks any. - Reverse. Restore the old doc lines in
stdlib/segtree.cpandstdlib/lazy.cp.