Programming Techniques

  • Antti LaaksonenEmail author
Part of the Undergraduate Topics in Computer Science book series (UTICS)


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.

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  1. 1.Department of Computer ScienceUniversity of HelsinkiHelsinkiFinland

Personalised recommendations