{"title":"Optimal Resizable Arrays","authors":"Robert E. Tarjan, Uri Zwick","doi":"10.1137/23m1575792","DOIUrl":null,"url":null,"abstract":"SIAM Journal on Computing, Volume 53, Issue 5, Page 1354-1380, October 2024. <br/> Abstract. A resizable array is an array that can grow and shrink by the addition or removal of items from its end, or both its ends, while still supporting constant-time access to each item stored in the array given its 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 [math] using only [math] space, with [math] amortized time, or even [math] worst-case time, per operation. Sitarski, and (apparently independently) Brodnik, Carlsson, Demaine, Munro, and Sedgewick describe much better solutions that maintain a resizable array of size [math] using only [math] space, still with [math] time per operation. Brodnik et al. give a simple proof that this is best possible. We distinguish between the space needed for storing a resizable array, and accessing its items, and the temporary space that may be needed while growing or shrinking the array. For every integer [math], we show that [math] space is sufficient for storing and accessing an array of size [math], if [math] space can be used briefly during grow and shrink operations. Accessing an item by index takes [math] worst-case time, while grow and shrink operations take [math] amortized time. Using an exact analysis of a growth game, we show that for any data structure from a wide class of data structures that uses only [math] space to store the array, the amortized cost of grow is [math], even if only grow and access operations are allowed. The time for grow and shrink operations cannot be made worst-case unless [math].","PeriodicalId":49532,"journal":{"name":"SIAM Journal on Computing","volume":"206 1","pages":""},"PeriodicalIF":1.2000,"publicationDate":"2024-09-17","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"SIAM Journal on Computing","FirstCategoryId":"94","ListUrlMain":"https://doi.org/10.1137/23m1575792","RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, THEORY & METHODS","Score":null,"Total":0}
引用次数: 0
Abstract
SIAM Journal on Computing, Volume 53, Issue 5, Page 1354-1380, October 2024. Abstract. A resizable array is an array that can grow and shrink by the addition or removal of items from its end, or both its ends, while still supporting constant-time access to each item stored in the array given its 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 [math] using only [math] space, with [math] amortized time, or even [math] worst-case time, per operation. Sitarski, and (apparently independently) Brodnik, Carlsson, Demaine, Munro, and Sedgewick describe much better solutions that maintain a resizable array of size [math] using only [math] space, still with [math] time per operation. Brodnik et al. give a simple proof that this is best possible. We distinguish between the space needed for storing a resizable array, and accessing its items, and the temporary space that may be needed while growing or shrinking the array. For every integer [math], we show that [math] space is sufficient for storing and accessing an array of size [math], if [math] space can be used briefly during grow and shrink operations. Accessing an item by index takes [math] worst-case time, while grow and shrink operations take [math] amortized time. Using an exact analysis of a growth game, we show that for any data structure from a wide class of data structures that uses only [math] space to store the array, the amortized cost of grow is [math], even if only grow and access operations are allowed. The time for grow and shrink operations cannot be made worst-case unless [math].
期刊介绍:
The SIAM Journal on Computing aims to provide coverage of the most significant work going on in the mathematical and formal aspects of computer science and nonnumerical computing. Submissions must be clearly written and make a significant technical contribution. Topics include but are not limited to analysis and design of algorithms, algorithmic game theory, data structures, computational complexity, computational algebra, computational aspects of combinatorics and graph theory, computational biology, computational geometry, computational robotics, the mathematical aspects of programming languages, artificial intelligence, computational learning, databases, information retrieval, cryptography, networks, distributed computing, parallel algorithms, and computer architecture.