论文标题
最佳可解析阵列
Optimal resizable arrays
论文作者
论文摘要
a \ emph {Resizizizable Array}是一个数组,可以通过从其末端或其末端添加或删除\ Emph {grow}和\ emph {shrink},同时仍然支持恒定时间\ emph {access},以\ emph {Index}存储在阵列中的每个项目中。由于数组的大小,即其中的项目数,随着时间的推移会有所不同,因此可解析数组的空间有效维护需要动态内存管理。一种标准的加倍技术允许仅使用$ o(n)$空间维护一个尺寸〜$ n $的数组,并带有$ o(1)$摊销时间,甚至$ o(1)$ o(1)$最差的时间。 Sitarski和Brodnik等人描述了仅使用$ n+O(\ sqrt {n})$ space仅使用$ o(1)$时间的$ o(1)$时间来维护可解析的尺寸〜$ n $的更好解决方案。 Brodnik等人\给出一个简单的证据,证明这是最好的。 我们区分\ emph {储存}一个可分解的数组所需的空间,并访问其项目,以及在生长或缩小数组时可能需要的\ emph {临时}空间。对于每个整数$ r \ ge 2 $,我们表明$ n+o(n^{1/r})$空间足以存储和访问大小〜$ n $的数组,如果$ n+o(n^{1-1/r})$空间可以在种植和缩小操作过程中短暂使用。访问索引的物品需要$ o(1)$最差的时间,而成长和收缩操作则花费$ o(r)$摊销时间。使用对\ emph {增长游戏}的精确分析,我们表明,对于仅使用$ n+o(n^{1/r})$空间存储阵列的任何数据结构的任何数据结构,即使只允许增长和访问操作,摊销的成本为$ω(r)$。除非$ r = 2 $,否则不能使成长和收缩操作的时间无法制定。
A \emph{resizable array} is an array that can \emph{grow} and \emph{shrink} by the addition or removal of items from its end, or both its ends, while still supporting constant-time \emph{access} to each item stored in the array given its \emph{index}. Since the size of an array, i.e., the number of items in it, varies over time, space-efficient maintenance of a resizable array requires dynamic memory management. A standard doubling technique allows the maintenance of an array of size~$N$ using only $O(N)$ space, with $O(1)$ amortized time, or even $O(1)$ worst-case time, per operation. Sitarski and Brodnik et al.\ describe much better solutions that maintain a resizable array of size~$N$ using only $N+O(\sqrt{N})$ space, still with $O(1)$ time per operation. Brodnik et al.\ give a simple proof that this is best possible. We distinguish between the space needed for \emph{storing} a resizable array, and accessing its items, and the \emph{temporary} space that may be needed while growing or shrinking the array. For every integer $r\ge 2$, we show that $N+O(N^{1/r})$ space is sufficient for storing and accessing an array of size~$N$, if $N+O(N^{1-1/r})$ space can be used briefly during grow and shrink operations. Accessing an item by index takes $O(1)$ worst-case time while grow and shrink operations take $O(r)$ amortized time. Using an exact analysis of a \emph{growth game}, we show that for any data structure from a wide class of data structures that uses only $N+O(N^{1/r})$ space to store the array, the amortized cost of grow is $Ω(r)$, even if only grow and access operations are allowed. The time for grow and shrink operations cannot be made worst-case, unless $r=2$.