Problems solving: Algorithms and Complexity (2020/2021)

Course code
Name of lecturers
Romeo Rizzi, Ferdinando Cicalese
Romeo Rizzi
Number of ECTS credits allocated
Academic sector
Language of instruction
II semestre dal Mar 1, 2021 al Jun 11, 2021.

Lesson timetable

Go to lesson schedule

Learning outcomes

The overall targets of the course is to expose some aspects of the deep and important dialectic exchange between the search for algorithmic solutions and the study of the complexity of problems. Algorithms are the backbone and the substance of information technologies, but at the same time their study goes beyond the "mere" computer science and is pervasive to all the disciplines that are problem-bearers. The design of an algorithm starts from the study of the structure of the problem to be solved and it usually represents the highest achievement of this process. The study of algorithms requires and offers methodologies and techniques of problem solving, logical and mathematical skills. The course therefore aims to provide students with fundamental skills and methodologies for the analysis of problems and the design of the algorithms for solving them. Particular emphasis is given to the efficiency of the algorithms themselves, and the theory of computational complexity plays a profound methodological role in the analysis of problems. With reference to the overall didactic aims of the Master program, the course leads students to deepen and expand the three-year training in the field of analysis and evaluation of problems, algorithms, and computational models, providing a wealth of advanced tools to address non-trivial problems in different IT fields. The students will acquire logical-mathematical skills, techniques, experience and methodologies useful in the analysis of algorithmic problems, from detecting their structure and analyzing their computational complexity to designing efficient algorithms, and then planning and conducting their implementation. Besides that, The course provides the foundations of computational complexity theory, focussing on: the theory of NP-completeness; approximation algorithms and basic approaches for the analysis of the approximation guarantee of algorithms for hard problems; and parameterized approaches to hard problems. The student will apply the main algorithmic techniques: recursion, divide and conquer, dynamic programming, some data structures, invariants and monovariants. The student will develop sensitivity about which problems can be solved efficiently and with which techniques, acquiring also dialectical tools to place the complexity of an algorithmic problem and identify promising approaches for the same, looking at the problem to grasp its structure. She will learn to produce, discuss, evaluate, and validate conjectures, and also independently tackle the complete path from the analysis of the problem, to the design of a resolver algorithm, to the coding and experimentation of the same, even in research contexts either in the private sector or at research institutions. Based on the basic notions acquired of computational complexity, the students will be able to employ reductions, standard techniques in complexity theory, to analyze the structural properties of computational problems and identify possible alternative approaches (approximation, parameterization) in the absence of (provably) efficient solutions After attending the course the students will be able to: classify intractable computational problems; understand and verify a formal proof; read and understand a scientific article where a new algorithm is presented together with the analysis of its computational complexity.


The Yin and the Yang of problem solving are the general methods for the solutions of instances of the problem (the Algorithms) on one side, and a detached aesthetic eye on the richness of the problem (Complexity) on the other. Two passionate enthusiasts will guide you in the exploration of these two synergistic arts with the hope that in you they might merge into just one.


1. The workflow of problem solving: analysis and comprehension of the problem, conception of an algorithmic solution, design of an efficient algorithm, planning the implementation, conducting the implementation, testing and debugging.

2. Methodology in analyzing a problem:
The study of special cases. Particularization and generalization.
Building a dialog with the problem. Conjectures. Simplicity assumptions.
Solving a problem by reducing it to another. Reductions among problems to organize them into classes. Reducing problems to isolate the most fundamental questions. The role of complexity theory in classifying problems into classes. The role of complexity theory in analyzing problems. Counterexamples and NP-hardness proofs. Good conjectures and good characterizations. The belief can make conjectures true. Decomposing problems and inductive thinking.

3. Algorithm design general techniques.
Recursion. Divide et impera. Recursion with memoization. Dynamic programming (DP). Greedy.
DP on sequences. DP on DAGs. More in depth: good characterization of DAGs and scheduling, composing partial orders into new ones.
DP on trees. More in depth: adoption of the children one by one; advantages of an edge-centric vision over the node-centric one.
The asymptotic eye on worst case performance guides the design of algorithms:
the binary search example; negligible improvements; amortized analysis.
Some data structures: binary heaps; prefix-sums; Fenwick trees; range trees.

4. Algorithms on graphs and digraphs.
Bipartite graphs: recognition algorithms and good characterizations.
Eulerian graphs: recognition algorithms and good characterizations.
Shortest paths. Minimum spanning trees.
Maximum flows and minimum cuts.
Bipartite matchings and node covers.
The kernel of a DAG. Progressively finite games. Sums of games.

5. General hints on implementing, coding, testing and debugging.
Plan your implementation. Anticipate the important decisions, and realize where the obscure points are. Try to go round the most painful issues you foresee. Code step by step. Verify step by step. Use the assert. Testing and debugging techniques. Self-certifying algorithms.


Relationships among computational problems. Polynomial reductions of one problem into another. The classes P, NP, co-NP. Notion of completeness. Proofs od NP-completeness: Cook's theorem; proofs of completeness using appropriate reductions. Search and Decision Problems. Self-Reducibility of NP-complete problems and existence of non-selfreducible problems.
Space Complexity. Models and fundamental difference between the use of time resource and the space resource. Completeness for space complexity classes. The classes PSPACE and NPSPACE. Examples of reductions to prove PSPACE-completeness.

Introduction to the approximation algorithms for optimisation problems. Examples of approximation algorithms. Classification of problems with respect to their approximabuility. The classes APX, PTAS, FPTAS. Notion of inapproximability; the gap technique to prove inapproximability results; examples of approximation preserving reductions.

Examples of simple randomised algorithms in solving hard problems. . Examples of parameterized approaches to solve hard problems.

Reference books
Author Title Publisher Year ISBN Note
J. Kleinberg, É. Tardos Algorithm Design (Edizione 1) Addison Wesley 2006 978-0321295354
Ingo Wegener Complexity Theory Springer 2005
Garey, M. R. and Johnson, D. S. Computers intractability: a guide to the theory of NP-completeness Freeman 1979 0-7167-1045-5
Michael Sipser Introduction to the Theory of Computation PWS 1997 053494728X
T. Cormen, C. Leiserson, R. Rivest, C. Stein Introduzione agli Algoritmi e Strutture Dati (Edizione 2) McGraw-Hill 2005 88-386-6251-7
Cristopher Moore, Stephan Mertens The Nature of Computation Oxford 2011

Assessment methods and criteria

The exam consists of a written test and a programming test, and the final grade is determined by the sum of the points in both tests. Both tests will include both topics of Algorithms and Complexity to verify that the student has acquired competence in both subjects and can exploit their complementarity.

Examples and additional information on the lab test can be found at:

Examples of the type of exercises included in the written test can be found at the repo: