Modula-2 pp 217-242 | Cite as

Dynamic Data Structures

  • Daniel Thalmann

Abstract

In Section 16.4, we presented a module for handling several stacks. Although the definition module was well designed, it did have one important drawback: the maximum number of elements in a stack had to be defined. The reason for this was that the stacks were implemented using arrays. Typically, a stack differs from an array, because the number of elements in a stack is always varying. We say that an array is a static data structure, whereas a stack is a dynamic data structure. To simulate this dynamic structure using an array, we introduced an index (called Top) which indicated the element which was last entered on the stack. As illustrated in Fig. 19.1, if the maximum size of the array is 50, the only difference between a stack of 5 elements and a stack of 49 elements is the value of Top. The space required for 50 elements is reserved, even if it is not necessary.

Keywords

Binary Tree Dynamic Variable Pointer Type Dynamic Allocation Fifo Queue 
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.

Copyright information

© Springer-Verlag Berlin Heidelberg 1985

Authors and Affiliations

  • Daniel Thalmann
    • 1
  1. 1.Département d’Informatique et Recherche OpérationnelleUniversité de MontréalMontréal (Quebec)Canada

Personalised recommendations