Chapter 11. Sequences

A sequence holds N values associated with the integer indices zero through N–1 when N is positive. An empty sequence holds no values. Like arrays, values in a sequence may be accessed by indexing; they can also be added to or removed from either end of a sequence. Sequences expand automatically as necessary to accommodate their contents. Values are pointers.

Sequences are one of the most useful ADTs in this book. Despite their relatively simple specification, they can be used as arrays, lists, stacks, queues, and deques, and they often subsume the facilities of separate ADTs for these data structures. A sequence can be viewed as a more abstract version of the dynamic array described in the previous chapter. A sequence hides ...

Get C Interfaces and Implementations: Techniques for Creating Reusable Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.