# Algorithms (2019/2020)

Course code
4S02709
Credits
12
Coordinator
Romeo Rizzi
Teaching is organised as follows:
COMPLESSITÀ 6 ING-INF/05-INFORMATION PROCESSING SYSTEMS II semestre Ferdinando Cicalese
ALGORITMI 6 ING-INF/05-INFORMATION PROCESSING SYSTEMS II semestre Romeo Rizzi

#### Learning outcomes

We refer to the web pages of the modules for the complete and precise list of goals of the course as divided into its two parts. We limit ourselves to focus here on the overall targets of the Algorithm course, as a whole, which 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. Here, we can only touch upon the nature of the privileged relationship of these two disciplines, and their actual unity (like the Yin and Yang sides of a single one art), hoping, nonetheless, that this will help orienting the student in tackling this adventurous path with the right enthusiasm and perspective. 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. For non-trivial problems, the process of algorithm design rests on the theory of complexity not only to identify on which questions, and subproblems, it may make sense to concentrate efforts, but also as a dialectical counterpart providing the right language to disclose the subtle nuances of the problem and guiding towards the appropriate way of addressing its solution. A goal of the course is to highlight and illustrate the symbiosis between the competences (algorithm design and the study of problem complexity) which are addressed in the two modules. 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.

#### Syllabus

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.

#### Assessment methods and criteria

Because of the CoVid19 emergency the organization and procedures of the exam have departed from what written more below in the official version. Since things are in continuous evolution, and we want to make sure no student gets lost, we redirect the student directly to the reference service site that we can maintain constantly updated:

http://profs.sci.univr.it/~rrizzi/classes/Algoritmi/index.html

We warmly advise every student to subscribe to the Telegram group for the 2020 edition of the course. This and other useful resources are conveniently accessed from the URL here above.

HERE BELOW FOLLOWS THE OFFICIAL VERSIONE THAT WAS INSERTED HERE AT THE BEGINNING OF THE ACADEMIC YEAR:

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:
https://cms.di.unipi.it/algo/

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):

http://profs.sci.univr.it/~rrizzi/classes/Algoritmi/index.html

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.

 Author Title Publisher Year ISBN Note J. Kleinberg, É. Tardos Algorithm Design (Edizione 1) Addison Wesley 2006 978-0321295354 Garey, M. R. and Johnson, D. S. Computers intractability: a guide to the theory of NP-completeness Freeman 1979 0-7167-1045-5 T. Cormen, C. Leiserson, R. Rivest, C. Stein Introduzione agli Algoritmi e Strutture Dati (Edizione 2) McGraw-Hill 2005 88-386-6251-7 Michael Sipser Introduction to the Theory of Computation PWS 1997 053494728X Cristopher Moore, Stephan Mertens The Nature of Computation Oxford 2011 Sanjoy Dasgupta, Christos Papadimitriou, Umesh Vazirani Algorithms (Edizione 1) McGraw-Hill Higher Education 2007 978-0-07-352340-8 Steven S Skiena, Miguel A. Revilla Programming Challenges: The Programming Contest Training Manual (Edizione 2013) Springer New York, 2013 2003 147578970X