Worst-case-efficient dynamic arrays in practice
Research output: Chapter in Book/Report/Conference proceeding › Article in proceedings › Research › peer-review
The basic operations of a dynamic array are operator[], push back, and pop back. This study is an examination of variations of dynamic arrays that support these operations at O(1) worst-case cost. In the literature, many solutions have been proposed, but little information is available on their mutual superiority. Most library implementations only guarantee O(1) amortized cost per operation. Four variations with good worst-case performance were benchmarked: (1) resizable array relying on doubling, halving, and incremental copying; (2) level-wiseallocated pile; (3) sliced array with fixed-capacity slices; and (4) blockwise-allocated pile. Let |V| denote the size of the values of type V and |V*| the size of the pointers to values of type V, both measured in bytes. For an array of n values and a slice of S values, the space requirements of the considered variations were at most 12|V|n+O(|V*|), 2|V|n+O(|V*| lg n), |V|(n + S) + O(|V*|n/S), and |V|n + O((|V| + |V*| + |V**|) √n) bytes, respectively. A sliced array that uses a few per cent of extra space turned out to be a reasonable solution in practice. In general, for worst-case-efficient variations, the operations were measurably slower than those for the C++ standard-library implementation. Moreover, slicing can make the structures fragile, so measures to make them more robust are proposed.
Original language | English |
---|---|
Title of host publication | Experimental Algorithms : 15th International Symposium, SEA 2016, St. Petersburg, Russia, June 5-8, 2016, Proceedings |
Editors | Andrew V. Goldberg, Alexander S. Kulikov |
Number of pages | 17 |
Publisher | Springer |
Publication date | 2016 |
Pages | 167-183 |
ISBN (Print) | 978-3-319-38850-2 |
ISBN (Electronic) | 978-3-319-38851-9 |
DOIs | |
Publication status | Published - 2016 |
Event | 15th International Symposium on Experimental Algorithms - St. Petersborg, Russian Federation Duration: 5 Jun 2016 → 8 Jun 2016 Conference number: 15 |
Conference
Conference | 15th International Symposium on Experimental Algorithms |
---|---|
Nummer | 15 |
Land | Russian Federation |
By | St. Petersborg |
Periode | 05/06/2016 → 08/06/2016 |
Series | Lecture notes in computer science |
---|---|
Volume | 9685 |
ISSN | 0302-9743 |
ID: 172139374