paper

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

arXiv:1311.6093 · doi:10.13140/RG.2.1.2394.2485

Abstract

Given a -dimensional array , an update operation adds a given constant to each element within a continuous sub-array of . A query operation computes the sum of all the elements within a continuous sub-array of . 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 -dimensions which achieves 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 per update/query.

14 Pages, 3 Figures, 1 Table

Cited by in corpus (4)