Are range updates possible on 2-D segment trees?

Revision en1, by pranet, 2016-06-01 01:23:02

I was trying to implement the following functions on a N * N grid in O(log^2(N)) time:

  1. Update: Add v to all grid points in specified rectangle. (v, rectangle are specified in this update)

  2. Query: Print maximum value in specified rectangle. (rectangle is specified in this query)

I tried implementing a 2-D segment tree, but got stuck with the range updates part (lazy propagation in 2-D dimensions is not pretty)

Is it even possible to do so? (anything below O(N) per operation is fine).

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English pranet 2016-06-01 01:23:02 552 Initial revision (published)