Advertisement

Resizable Arrays in Optimal Time and Space

  • Andrej Brodnik
  • Svante Carlsson
  • Erik D. Demaine
  • J. Ian Ian Munro
  • Robert Sedgewick
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1663)

Abstract

We present simple, practical and efficient data structures for the fundamental problem of maintaining a resizable one-dimensional array, A[l..l + n1], of fixed-size elements, as elements are added to or removed from one or both ends. Our structures also support access to the element in position i. All operations are performed in constant time. The extra space (i.e., the space used past storing the n current elements) is O(√n) at any point in time. This is shown to be within a constant factor of optimal, even if there are no constraints on the time. If desired, each memory block can be made to have size 2kc for a specified constant c, and hence the scheme works effectively with the buddy system. The data structures can be used to solve a variety of problems with optimal bounds on time and extra storage. These include stacks, queues, randomized queues, priority queues, and deques.

Keywords

Lookup Table Data Block Priority Queue Memory Block Extra Space 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    A. Brodnik. Computation of the least significant set bit. In Proceedings of the 2nd Electrotechnical and Computer Science Conference, Portoroz, Slovenia, 1993.Google Scholar
  2. 2.
    A. Brodnik, S. Carlsson, E. D. Demaine, J. I. Munro, and R. Sedgewick. Resizable arrays in optimal time and space. Technical Report CS-99-09, U. Waterloo, 1999.Google Scholar
  3. 3.
    M. Dietzfelbinger, A. Karlin, K. Mehlhorn, F. Meyer auf der Heide, H. Rohnert, and R. E. Tarjan. Dynamic perfect hashing: Upper and lower bounds. SICOMP, 23(4):738–761, Aug. 1994.MathSciNetzbMATHGoogle Scholar
  4. 4.
    M. L. Fredman and D. E. Willard. Surpassing the information theoretic bound with fusion trees. JCSS, 47(3):424–436, 1993.MathSciNetzbMATHGoogle Scholar
  5. 5.
    M. T. Goodrich and J. G. Kloss II. Tiered vector: An efficient dynamic array for JDSL. This volume.Google Scholar
  6. 6.
    D. E. Knuth. The Art of Computer Programming. Addison-Wesley, 1968.Google Scholar
  7. 7.
    M. K. McKusick, K. Bostic, M. J. Karels, and J. S. Quarterman. The Design and Implementation of the 4.4 BSD Operating System. Addison-Wesley, 1996.Google Scholar
  8. 8.
    R. Motwani and P. Raghavan. Randomized Algorithms. Camb. Univ. Press, 1995.Google Scholar
  9. 9.
    W. H. Press, B. P. Flannery, S. A. Teukolsky, and W. T. Vetterling. Numerical Recipes in C: The Art of Scientific Computing. Camb. Univ. Press, 2nd ed., 1992.Google Scholar
  10. 10.
    R. Sedgewick. Algorithms in C. Addison-Wesley, 3rd ed., 1997.Google Scholar
  11. 11.
    B. Stroustrup. The C++ Programming Language. Addison-Wesley, 3rd ed., 1997.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1999

Authors and Affiliations

  • Andrej Brodnik
    • 1
    • 2
  • Svante Carlsson
    • 2
  • Erik D. Demaine
    • 3
  • J. Ian Ian Munro
    • 3
  • Robert Sedgewick
    • 4
  1. 1.Dept. of Theoretical Computer ScienceInstitute of Mathematics, Physics, and MechanicsLjubljanaSlovenia
  2. 2.Dept. of Computer Science and Electrical EngineeringLuleå University of TechnologyLuleåSweden
  3. 3.Dept. of Computer ScienceUniversity of WaterlooWaterlooCanada
  4. 4.Dept. of Computer SciencePrinceton UniversityPrincetonUSA

Personalised recommendations