Skip to main content

Vector Programming

  • Chapter
Data Structure Programming

Part of the book series: Undergraduate Texts in Computer Science ((UTCS))

Abstract

Suppose that you have a problem in which you need an array, but the size of the array can’t be known at the time at which you create it. An example is when you need to read in data from a file of unknown size and process it. You need to create the array in which you wish to put the data before you begin to read the file, but you won’t know until the end of the file how much data there is. Vectors are ideal for this kind of problem, provided that the problem only requires the array to grow at one end. If it must grow at both ends, then a deque is better suited to the task. Here we are assuming, of course, that the other processing required of the data requires an array-like structure. If we don’t require random access iterators in our processing, then a list will probably be a better choice in which to hold the data.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 1998 Springer Science+Business Media New York

About this chapter

Cite this chapter

Bergin, J. (1998). Vector Programming. In: Data Structure Programming. Undergraduate Texts in Computer Science. Springer, New York, NY. https://doi.org/10.1007/978-1-4612-1630-8_5

Download citation

  • DOI: https://doi.org/10.1007/978-1-4612-1630-8_5

  • Publisher Name: Springer, New York, NY

  • Print ISBN: 978-1-4612-7223-6

  • Online ISBN: 978-1-4612-1630-8

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics