Algorithms - ALGORITMI (2017/2018)

Course code
Name of lecturer
Romeo Rizzi
Number of ECTS credits allocated
Academic sector
Language of instruction
II sem. dal Mar 1, 2018 al Jun 15, 2018.

To show the organization of the course that includes this module, follow this link * Course organization

Lesson timetable

Go to lesson schedule

Learning outcomes

Algorithms form the backbone and are at the very heart of computer science,
but they also candidate as the most ancient precursors of informatics and are transversal and pervasive over all disciplines.
Their design requires the study and comprehension of the structure of the problem at hand, and most of the time it means and results into the crowning of this effort. The study of algorithms requires and offers methodologies and techniques of problem solving, and logical and mathematical competences.

The course aims at stimulating the students and guide them in their path to acquire the competencies and basic methodologies required when facing the analysis of problems and in the design of algorithms for their solution.
A first target is to make the students fully aware that in order to obtain solutions (algorithms) you must first go through a study and comprehension of the problem.
Particular emphasis is given to the methodological aspects:
the study of special cases, the role of conjecturing, proof techniques, building a dialog with the problem, and detection of its structure.
A second target is to build up a good relationship and active knowledge of the inductive approach, and accustom students with the use of recursion in practice.
The students are challenged to slash induction as a queen problem solving tool.
Among the dialects of induction introduced, we insist on memoization and dynamic programming. The student is required to acquire dynamic programming as a technique of problem solving and algorithm design.
Particular emphasis is given to the efficiency of algorithms.
Complexity Theory (of the twin didactic unit) plays a profound methodological role in the analysis of problems.
A main target of the course is to explicit, emphasize and illustrate this role. Last but not least, the path and process comprising the solution of a problem must be complete. Thanks to the several didactic problems made available in the automatic evaluation system used during the laboratory sessions,
the student experiments and learns how to manage all the following phases:
study and comprehension of the problem, conception of an algorithmic solution,
design of an efficient algorithm, planning the implementation, conducting the implementation, testing and debugging.


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.

Reference books
Author Title Publisher Year ISBN Note
T. Cormen, C. Leiserson, R. Rivest Introduction to algorithms (Edizione 1) MIT Press 1990 0262031418

Assessment methods and criteria

Students must face a 5 hours test held in computer room. Here, they are assigned some problems. The students must analyze and comprehend the problem and its structure, think of possible algorithmic solutions, design an algorithm and implement it in c/c++ or Pascal. The most efficient their algorithm is, the more points they will get.
During the exam, the students can submit their source codes to a site organized precisely as the one they have experimented during the exercise sessions in lab and/or at home. In this way they can get an immediate and contextual feedback that can guide them in conducting and managing their exam at their best.
Their solutions are evaluated based on the subtasks of the problem that they can solve correctly within the allotted computation time and memory as fixed by each single problem or subtask of it.
In this way, the efficiency of the solutions and algorithms they have designed and coded determines the final scores.
It is guaranteed that, at every exam session, at least one problem will be chosen among the problems that have been proposed and made available at the site for the home/laboratory exercises.
Often, other problems are taken from the COCI competitions or among problems of the olympiads in informatics or in problem solving.
Even after having achieved a positive vote, the student can participate to later exam sessions and see whether he can improve its current mark without any risk of reducing or tampering it anyhow: our policy is to keep the best mark ever.
To the mark from the exam are summed the points the students may have possibly collected in projects. As possible projects, this year we proposed the students to help us in designing problems and/or help us in the realization of a new system for the compilation of problem packages of new conception.
As such, each student has its own mark wallet. When the students decides he wants his (positive) mark registered, then the final mark is obtained as the average with the mark for the Computational Complexity twin module (which must also be positive in order to proceed) and this average is the mark for the whole course.

The site for the home/laboratory exercises:

and the problems you find there, are your first resource for preparing to your exam. The system you will encounter at the exam is a clone of it.

For more information on the modalities and possibilities at the exam, and for further preparation material, explore the site of the course (and help us improving it):

Here you can find the wallet of your marks for both the "Algorithms" and the "Computationl Complexity" modules comprising the course (if any), plus your extra scores for Algorithms in case you have collected any of them with projects.
You will also find here the problems given at previous exam sessions,
and more detailed instructions on the procedures for the exam and for the composition and registration of your final mark.