# A New Algorithm for Updating and Querying Sub-arrays of Multidimensional Arrays

arXiv: https://arxiv.org/abs/1311.6093 · HTML: https://mlsanity.com/paper/1311.6093/

## Key facts

- Cited by 1 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 24 Nov 2013.

## Built on by (most cited first, 1 of 1)

- [Practical Performance Guarantees for Pipelined DNN Inference](https://mlsanity.com/paper/2311.03703/) (2023)

## Abstract (arXiv)

Given a d-dimensional array A, an update operation adds a given constant C to each element within a continuous sub-array of A. A query operation computes the sum of all the elements within a continuous sub-array of A. The one-dimensional update and query handling problem has been studied intensively and is usually solved using segment trees with lazy propagation technique. In this paper, we present a new algorithm incorporating Binary Indexed Trees and Inclusion-Exclusion Principle to accomplish the same task. We extend the algorithm to update and query sub-matrices of matrices (two-dimensional array). Finally, we propose a general form of the algorithm for d-dimensions which achieves O(4d*logdn) time complexity for both updates and queries. This is an improvement over the previously known algorithms which utilize hierarchical data structures like quadtrees and octrees and have a worst-case time complexity of Omega(nd-1) per update/query.
