Skip to content

Algorithm Engineering (a.a. 2025‐26)

Paolo Ferragina edited this page Sep 14, 2026 · 75 revisions

This is the material for the course "Algorithms Engineering" taught (since 2009, see the historical Algorithm Engineering's original page) in the master's programme in Computer Science and Networking, held at the Department of Computer Science of the University of Pisa

General infos

Teacher: Paolo Ferragina

CFU: 9 (first semester).

Course ID: 531AA.

Language: English.

Question time: Monday: 15-17, or by appointment (also in video-conferencing through the virtual room of the course)

News: about this course will be distributed via a Telegram channel.

Official lectures schedule: The schedule and content of the lectures are available below and with the official registro.

Goals

In this course, we will study, design, and analyze advanced algorithms and data structures for the efficient solution of combinatorial problems involving all basic data types, such as integers, strings, (geometric) points, trees, and graphs. The design and analysis will involve several models of computation— such as RAM, 2-level memory, cache-oblivious, and streaming— in order to take into account the architectural features and the memory hierarchy of modern PCs and the availability of Big Data upon which those algorithms could work. We will add to such theoretical analysis several other engineering considerations spurring from the implementation of the proposed algorithms and from experiments published in the literature.

Every lecture will follow a problem-driven approach that starts from a real software-design problem, abstracts it in a combinatorial way (suitable for an algorithmic investigation), and then introduces algorithms aimed at minimizing the use of some computational resources like time, space, communication, I/O, energy, etc. Some of these solutions will also be discussed at an experimental level, in order to introduce proper engineering and tuning tools for algorithmic development.

Week Schedule of the Lectures

The course consists of 2 hours of lectures in the first three days of the week, from 9 AM to 11 AM.

  • Monday: 9:00 - 11:00, Room Fib C
  • Tuesday: 9:00 - 11:00, Room Fib C
  • Wednesday: 9:00 - 11:00, Room Fib C

Exam

The exam will consist of a written test including two parts: exercises and theory questions. The exam is passed if in both parts the student gets a sufficient score (expressed in 30), which is then averaged.

The first (exercises) and the second (theory questions) parts of the exam can be split into different exam dates, even of different exam sessions. The exam dates are indicated in the calendar on ESAMI. If the second part is not passed or the student abandons the exam, (s)he can keep the rank of the first exam, but this may occur just once. The second time this happens, the rank of the first part is dropped, and the student has to do both parts again.

The schedule of the next exams follows, but the official dates/hours of the exams are in the website of the University of Pisa, where you have to register to participate in the exam.

Background and Notes of the Course

I strongly suggest refreshing your knowledge about basic Algorithms and Data Structures by looking at the well-known book Introduction to Algorithms, Cormen-Leiserson-Rivest-Stein (third edition). Specifically, I suggest you look at chapters 2, 3, 4, 6, 7, 8, 10, 11 (no perfect hash), 12 (no randomly built), 15 (no optimal BST), 18, 22 (no strongly connected components). Also, you could look at the Video Lectures, by Erik Demaine and Charles Leiserson, specifically Lectures 1-7, 9-10, and 15-17.

The content of the course will be covered mostly by the book published by Cambridge University Press as Pearls of Algorithm Engineering (with its errata corrige).

If you wish to practice on the exercise part of the exam, here is a zipped file containing previous exercises.

Lectures

The lectures below also include some EXTRA material, which is suggested to be read for students aiming for high rankings.

Date Topic Notes and Refs
15/09/25 Introducing the course and its topics. Refreshing some basic concepts on the analysis of algorithms: RAM model, time and space complexity, asymptotic analysis, polynomial versus exponential algorithms. Key issues about I/Os and hierarchical memory in managing massive datasets. The two-level memory model and I/O-costs. Slides on course introduction. Chap. 1.
16/09/25 An example of I/O-analysis on the simple problem of summing items stored in an array. Other examples of I/O-analysis: binary search versus B-tree search. The role of the Virtual Memory system: a probabilistic analysis. Read B-tree note1 and note2
17/09/25 Sorting versus Permuting, RAM versus two-level memory model. Permuting algorithm via sorting and scanning, and its I/O-bound. Comments on the I/O complexity of sorting and permuting. Binary MergeSort: I/O-analysis. The multi-way mergesort, with I/O analysis. Comments on impact of data compression. Sect. 5.1.
Students are warmly invited to refresh their know-how about the divide-and-conquer technique for algorithm design and Master Theorem for solving recurrent relations; and Binary Search Trees. Lectures 2, 9, and 10 of Demaine's course
22/09/25 Not given because the lecture rooms were not accessible.
23/09/25 Snow Plow, with complexity proof and an example. The case of D disks, and the disk striping technique with I/O evaluation. Lower bound for sorting: comparisons and I/Os.

EXTRA is the lower bound on permuting (sect. 5.2.2).
Sect. 5.1.2 (snow plow), 5.2 and 5.2.1 (lower bound), and 5.4 (but no Greed Sort).
24/09/25 Quicksort: recap on best-case, worst-case, and average-case with analysis. 2-way, 3-way, and double-pivot partition for better in-memory quicksort. Bounded Quicksort with space analysis. Selection of kth-ranked item in O(n log n) time, O(n log k) time, and in linear average time (with proof). Sect. 5.3, 5.3.1 (2- and 3-way QS), 5.3.2 (pivot selection), 5.3.3 (bounded QS)
29/09/25 Multi-way Quicksort: definition, design, and I/O-complexity. Selection of k-1 "good pivot" via Oversampling. Proof of the expected time complexity of Multi-way Quicksort. Sect. 5.3.4
30/09/25 Random sampling: disk model, known length (algorithms and proofs). Random sampling on the streaming model: known length. Reservoir sampling on unknown length streams: Algorithm and proofs. Chap. 3
01/10/25 On the intersection problem: merge-based solution, binarySearch-based solution, mutual partitioning, doubling, two-level scan. Their analysis. Lower bound. Interpolation search, with its time and space analysis. Chap. 6 and sect. 9.3.
06/10/25 Lab: The new wave of privacy-preserving data structures. Slides and talk by Mariagiovanna Rotundo.
07/10/25 Lab: The SDSL library. Slides and talk by Lorenzo Bellomo.
08/10/25 Lab: The SDSL library (contd). Slides of the previous lecture and talk by Lorenzo Bellomo.
13/10/25 Randomized data structures: skip list with time/space analysis and comments on I/Os. Randomized data structures: Treaps with their various types of operations: search a key, 3-sided range query. Notes, and see Demaine's lecture num. 12 on skip lists.
14/10/25 More on TREAPS: 3-sided range query, insert, delete, split, merge, and proof of their time complexity. Proof of the average depth of a Random Binary Search Tree (i.e., TREAP with random priorities). See notes previous lecture
15/10/25 String sorting: comments on the difficulty of the problem on disk, the lower bound. Multi-key Quicksort: algorithm and analysis. Ternary search tree. LSD-radix sort: asymptotic analysis in time and space, and proof of correctness. Chap. 7
20/10/25 String sorting: MSD-radix sort, uncompacted tries, and their implementation with arrays and hash tables. Prefix search: definition of the problem, reduction to lexicographic search of two types of pattern. Solution based on arrays, Front-coding, two-level indexing based on compacted tries. Analysis of space, I/Os, and time of all described solutions.

EXTRA is the asymptotic analysis in time and space of MSD-radix sort (Sect. 7.2.1).
Sect. 9.1 (array + FC), 9.4 (CT), 9.5 (PT).
21/10/25 Array-based string search. Two-level indexing based on Patricia Tries. Analysis of space, I/Os, and time of all described solutions.
27/10/25 Substring search: definition, properties, reduction to prefix search. The Suffix Array. Binary searching the Suffix Array: p log n. Suffix Array construction via qsort and its asymptotic analysis. Array LCP and its construction in quadratic time. All Chap. 10, but NO pages 156-158 for the use of LCP to get p + log n search (lemma 10.2). NO Skew and scan-based algorithms. NO sect 10.3.3. In sect 10.4 do only 10.4.4 (text mining).
28/10/25 Array LCP and its construction in linear time, with an example. Suffix trees: properties, construction from Suffix Arrays and LCP array, search operations.
29/10/25 Text mining over suffix arrays and suffix trees, and other exercises.
03/11/25 Hashing and hash tables: the dictionary problem, direct addressing, hashing with chaining, time and space complexity. Computational unfeasibility of simple uniform hashing. Chap. 8 (i.e. 8.1 and 8.2)
04/11/25 Universal hashing (definition and properties). One example of Universal nash functions, with correctness proof. Sect. 8.3, study all theorems with proof, except Theo 8.3 without proof (only the statement).
05/10/25 Other two examples of universal hash functions, without correctness proof. The "power of two choices" result. Cuckoo hashing: definition, operations, time/space complexity and an example. Sect 8.5.
10/11/25 MIDTERM EXAM in Room D3 (Polo Fibonacci) Text, solution, and results.
11/10/25 Cuckoo hashing (with proofs).
12/10/25 Minimal ordered perfect hashing: definition, properties, construction, space, and time complexity. Bloom Filter: properties, construction, query and insertion operations, error estimation (with proofs). Sect. 8.6 and 8.7 (extra is 8.7.1, Lower bound on BF space; don't do compressed BF)
17/11/25 Discussion on the probability of error in BF. Application of Bloom Filters to DBs, search engines, and P2P. Spectral Bloom Filter and its probability of error. Prefix-free codes, the notion of entropy. Shannon's Theorem and optimal codes.
18/11/25 Data Compression. Static, semistatic, and dynamic models for frequency estimation. Entropy. Huffman coding: definition, properties, relation to Entropy, and implementation. Canonical Huffman: definition, properties and implementation.
EXTRA: Proof of Huffman's optimality and cost
Chap. 12.
19/11/25 Arithmetic coding: algorithm, properties, the converter tool, correctness, and entropy bounds. Comparison against Huffman's coding.
24/11/25 Dictionary-based compressors: properties and algorithmic structure. LZ77 and LZSS: algorithm, implementation, and the issue of the finite window. Integer coding: the problem and some considerations. The codes Unary, Gamma and Delta, Variable-byte, and their space/time performance, and consideration of optimal distributions. Chap. 11 and 13 of the book. No (s,c)-dense code. No LZ78 and LZW.
25/11/25 Parameterised codes: Rice, PForDelta. Interpolative code. Exercises.
26/11/25 Exercises on integer codes.
01/12/25 Elias-Fano code: definition, properties, access and NextGEQ operations with their time/space complexity.
02/12/25 Rank and Select: definition and succinct solution for Rank in read-only mode and o(m) space and O(1) time. How to implement Rank-Select with Elias-Fano and get compressed space. Chap. 15: 15.1.1 (no Select implementation); 15.1.2 and 15.2.1
03/12/25 Exercises
15/12/25, at 11:00, room D3 (Polo Fibonacci) Final term exam

Clone this wiki locally