Skip to main content

Data Structures

  • Chapter
  • First Online:
Guide to Competitive Programming

Part of the book series: Undergraduate Topics in Computer Science ((UTICS))

  • 195k Accesses

Abstract

This chapter introduces the most important data structures of the C++ standard library. In competitive programming, it is crucial to know which data structures are available in the standard library and how to use them. This often saves a large amount of time when implementing an algorithm. Section 5.1 first describes the vector structure which is an efficient dynamic array. After this, we will focus on using iterators and ranges with data structures, and briefly discuss deques, stacks, and queues. Section 5.2 discusses sets, maps, and priority queues. Those data structures are often used as building blocks of efficient algorithms, because they allow us to maintain dynamic structures that support both efficient searches and updates. Section 5.3 shows some results about the efficiency of data structures in practice. As we will see, there are important performance differences that cannot be detected by only looking at time complexities.

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 EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    The worst-case time complexity of the operations is O(n), but this is very unlikely to occur.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Antti Laaksonen .

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Laaksonen, A. (2017). Data Structures. In: Guide to Competitive Programming. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-319-72547-5_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-72547-5_5

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-72546-8

  • Online ISBN: 978-3-319-72547-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics