Skip to main content

Programming Techniques

  • Chapter
  • First Online:
Guide to Competitive Programming

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

  • 196k Accesses

Abstract

This chapter presents some of the features of the C++ programming language that are useful in competitive programming and gives examples of how to use recursion and bit operations in programming. Section 2.1 discusses a selection of topics related to C++, including input and output methods, working with numbers, and how to shorten code. Section 2.2 focuses on recursive algorithms. First we will learn an elegant way to generate all subsets and permutations of a set using recursion. After this, we will use backtracking to count the number of ways to place n non-attacking queens on an \(n \times n\) chessboard. Section 2.3 discusses the basics of bit operations, and shows how to use them to represent subsets of sets.

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.

    In fact, the C++ standard does not exactly specify the sizes of the number types, and the bounds depend on the compiler and platform. The sizes given in this section are those you will very likely see when using modern systems.

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). Programming Techniques. In: Guide to Competitive Programming. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-319-72547-5_2

Download citation

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

  • 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