arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1311.6093cs.DS
收藏

一种新的多维数组子数组更新和查询算法

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

Pushkar Mishra

摘要:

给定$d$维数组$A$,更新操作将给定常数$C$添加到$A$的连续子数组内的每个元素。查询操作计算$A$的连续子数组中所有元素的和。一维更新和查询处理问题已经被深入研究,通常使用带有惰性传播技术的段树来解决。在本文中,我们提出了一个新的算法,结合二叉索引树和包含-排除原则来完成同样的任务。我们扩展算法更新和查询矩阵(二维数组)的子矩阵。最后,我们提出了一个一般形式的算法$d$ -维实现$\mathcal{O}(4^d*\log^{d}n)$时间复杂度的更新和查询。这是对先前已知的算法的改进,先前已知的算法利用像四叉树和八叉树的分层数据结构,并且具有每次更新/查询的$Ω(n^{d-1})$的最坏情况时间复杂度。

英文摘要:

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 $\mathcal{O}(4^d*\log^{d}n)$ 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 $Ω(n^{d-1})$ per update/query.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑