Skip to main content

Sorting and Searching

  • Chapter
  • First Online:
Guide to Competitive Programming

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

  • 4675 Accesses

Abstract

Many efficient algorithms are based on sorting the input data, because sorting often makes solving the problem easier. This chapter discusses the theory and practice of sorting as an algorithm design tool.

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 34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 44.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

Notes

  1. 1.

    The C\(++\)11 standard requires that the sort function works in \(O(n \log n)\) time; the exact implementation depends on the compiler.

  2. 2.

    Note that in some older compilers, the function make_tuple has to be used to create a tuple instead of braces (for example, make_tuple(2,1,4) instead of {2,1,4}).

  3. 3.

    Some people, including the author of this book, still use printed dictionaries. Another example is finding a phone number in a printed phone book, which is even more obsolete.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Antti Laaksonen .

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Laaksonen, A. (2020). Sorting and Searching. In: Guide to Competitive Programming. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-030-39357-1_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-39357-1_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-39356-4

  • Online ISBN: 978-3-030-39357-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics