最佳可调整大小数组

R. Tarjan, Uri Zwick
{"title":"最佳可调整大小数组","authors":"R. Tarjan, Uri Zwick","doi":"10.48550/arXiv.2211.11009","DOIUrl":null,"url":null,"abstract":"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 $\\Omega(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$.","PeriodicalId":93491,"journal":{"name":"Proceedings of the SIAM Symposium on Simplicity in Algorithms (SOSA)","volume":"4 1","pages":"285-304"},"PeriodicalIF":0.0000,"publicationDate":"2022-11-20","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":"{\"title\":\"Optimal resizable arrays\",\"authors\":\"R. Tarjan, Uri Zwick\",\"doi\":\"10.48550/arXiv.2211.11009\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"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 $\\\\Omega(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$.\",\"PeriodicalId\":93491,\"journal\":{\"name\":\"Proceedings of the SIAM Symposium on Simplicity in Algorithms (SOSA)\",\"volume\":\"4 1\",\"pages\":\"285-304\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2022-11-20\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"1\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Proceedings of the SIAM Symposium on Simplicity in Algorithms (SOSA)\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.48550/arXiv.2211.11009\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the SIAM Symposium on Simplicity in Algorithms (SOSA)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.48550/arXiv.2211.11009","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1

摘要

\emph{可调整大小的数组}是这样一种数组,它可以通过从其末端或两端添加或删除项来\emph{增长}和\emph{缩小},同时仍然支持对给定\emph{索引}的数组中存储的每个项进行恒定时间\emph{访问}。由于数组的大小(即其中的项数)随时间而变化,因此对可调整大小的数组进行有效的空间维护需要动态内存管理。标准的加倍技术允许只使用$O(N)$空间来维护大小为$N$的数组,每个操作的平摊时间为$O(1)$,甚至是最坏情况时间为$O(1)$。Sitarski和Brodnik等人描述了更好的解决方案,即仅使用$N+O(\sqrt{N})$空间维护可调整大小的数组$N$,每次操作仍然需要$O(1)$时间。Brodnik等人给出了一个简单的证明,证明这是最好的可能。我们区分了\emph{存储}可调整大小的数组和访问其项所需的空间,以及在增加或缩小数组时可能需要的\emph{临时}空间。对于每个整数$r\ge 2$,如果$N+O(N^{1-1/r})$空间可以在增长和收缩操作期间短暂使用,那么$N+O(N^{1/r})$空间足以存储和访问大小为$N$的数组。通过索引访问项需要$O(1)$最坏情况时间,而增长和收缩操作需要$O(r)$平摊时间。通过对\emph{增长博弈}的精确分析,我们表明,对于仅使用$N+O(N^{1/r})$空间来存储数组的大量数据结构中的任何数据结构,增长的平摊成本为$\Omega(r)$,即使只允许增长和访问操作。增长和收缩操作的时间不能做最坏情况,除非$r=2$。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Optimal resizable arrays
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 $\Omega(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$.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信