AD2DA (a.a. 2024‐25) - ferragina/AD2DA GitHub Wiki

This is the material for the course "Algorithms and Data structures for Data-intensive Applications", taught in the master program in Informatics for Digital Health, held at the Department of Computer Science of the University of Pisa.

General Infos

Teachers: Paolo Ferragina and Giovanni Manzini

CFU: 9 (first semester).

Course ID: 0002A.

Language: English.

Question time: Paolo Ferragina: Monday: 15-17, or by appointment (also in video-conferencing through the virtual room of the course. Giovanni Manzini: Tuesday: 15-17, or by appointment.

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.

Week Schedule of the Lectures

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

  • Monday: 11:00 - 13:00, Room PS4
  • Tuesday: 11:00 - 13:00, Room PS4
  • Wednesday: 11:00 - 13:00, Room Fib L1

Exam

The exam will consist of a written test including two parts: exercises and "oral" 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. In the case that 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.

  • 11/11/2024, start at 11:00, room PS4 - Midterm Exam: text, results.

Goals

The goal of this course is to enrich and strengthen the knowledge about basic algorithms and data structures, learned in undergraduate courses, with further models, methodologies, tools, and techniques to design, analyze, experiment, and improve solutions for managing massive datasets of multimodal types: integer, string, vector, text, time series, and (labeled) graph.

These knowledge and skills constitute the building blocks upon which Big Data platforms and applications are built (e.g., key-value stores, graph DBs, vector DBs, Transformers, …), so this theoretical part will provide students with the “methodological toolbox” for designing and evaluating their big data solutions, and for choosing the right library to adopt for their implementation.

The theoretical lectures will be complemented by some hands-on experience in coding with relevant programming libraries that offer the above-mentioned building blocks. The course provides most of the algorithmic prerequisites for the other courses of this master’s degree.

Syllabus

  • Key issues about I/Os, streaming, and hierarchical memory in managing massive datasets.
  • Algorithmic and data structure issues concerning atomic versus variable-length items.
  • Three fundamental tools: sorting, permuting, and sampling.
  • Key-value stores: From basic to advanced hash tables and tries.
  • Textual search engines: compressing and accessing posting lists (integer sequences) and text collections. Deduplicating similar/equal texts, clustering text collections.
  • Bio-Informatics engines: compressing and indexing arbitrary text for exact substring search.
  • Vector DBs: nearest neighbor search, hamming, or Euclidean distance.
  • Advanced storage: Streaming and random access to compressed raw files, time series, and (labeled) graphs.

Lectures will include in-depth discussions on the practical efficiency of the proposed algorithms and data structures, plus hands-on experience with coding solutions for some topics.

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 the 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), and in some small parts by notes and GitHub refs that will provide the materials of hands-on sessions.

If students wish to train themselves on the topics of this course, they can select some useful exercises from the following superset.

Lectures

Date Topic Notes and Refs
16/09/24 Key issues about I/Os, RAM *versus* two-level memory model, (asymptotic) time and I/O-complexity, the role of the hierarchical memory in managing massive datasets, an example of I/O-analysis. Chap. 1
17/09/24 Some example of I/O-analysis: binary search versus B-tree search. Sorting versus Permuting, RAM versus two-level memory model. Designing a scan_and_sort-based permuter. I/O-complexity of sorting and permuting. I/O-complexity of the binary mergesort. Sect. 5.1, 5.1.1. Read B-tree note1 and note2
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
18/09/24 Multi-way mergesort: I/O complexity and examples or real cases. The case of D disks, and the disk striping technique. Sampling m items out of n: the case of n known. Sect. 5.1.3 and 5.4 (no Greed Sort), 3.1 and 3.2.
23/09/24 Sampling m items from a stream of unknown length n: by a heap or by a reservoir, with their probabilistic analysis. Randomised data structure: skip list, with its time and space complexity. Sect. 3.3, and notes on skip list
25/09/24 Sorting strings: the case of qsort with time/space analysis; the lower bound in the comparison model. LSD Radix sort with time/space complexity analysis. MSD Radix sort with time/space complexity analysis. The Trie data structure, building and searching a pattern, with the analysis of time/space complexity. Sect. 7.1 and 7.2.
30/09/24 (part 1) Uncompacted trie and compacted trie, implementation with hash tables, and analysis of time and space. Ternary search tree, with time analysis. Sect. 7.3
30/09/24 (part 2) Exercises on tries and ternary search trees. Multi-key quicksort with time/space analysis and its optimality. Sect. 7.3
01/10/24 Dedup of equal objects (files, strings, etc.) via sorting, hash tables in memory, and hash-based sorting (with its probabilistic analysis). Dedup of similar objects: Locality-sensitive hashing, the case of Hamming distance, with probabilistic analysis. Notes
02/10/24 Locality sensitive hashing, off-line and on-line over hamming distance, the case of Cosine-based similarity, and the case of file similarity (aka edit distance), with their probabilistic analysis. Same notes as previous lecture.
07/10/24 Locality sensitive hashing: the case of documents; singling, Jaccard similarity and its sketches, with their probabilistic analysis. Same notes as previous lecture.
08/10/24 The structure of a (Web) search engine: crawler, indexer, retriever, ranker. Inverted list: dictionary + posting lists, with examples. How to index a dictionary of variable length strings: (compacted) tries, Patricia trie, and two-level indexing with Front coding. Sect. 9.1, 9.1.1, 9.1.2, 9.4, 9.5.
09/10/24 Examples of two-level indexing for exact search and prefix search. Auto-completion search. List intersection: merge-based approach, binary-search-based approach, mutual partitioning, and two-level intersection. Chap. 6 (no 6.3).
14/10/24 (part 1) Hash tables and the dictionary problem. Universal hashing: definition, properties, use in hashing with chaining. One example with proof, one example without proof. Chap 8, sect. 8.1, 8.2, 8.3 (theorem 8.3 no).
14/10/24 (part 2) Cuckoo hashing: definition, properties, time and space complexity of the various operations (with proof). Minimal ordered perfect hashing: definition, properties, and implementation. Examples of Cuckoo and MOPH. Sect 8.5 and 8.6.
16/10/24 Exercises.
21/10/24 Bloom Filter: properties, operations (interest and search), time and space cost, with proofs. Exercises.
22/10/24 Textual ranking: TF-IDF, the vector space model, the case of sparse vectors, cosine similarity and its computation via Inverted Lists. Some approaches to speed up the computation of the "best" documents for a query. Exercises. Slides
23/10/24 Elastic search: an hands-on experience Code and slides
28/10/24 Document similarity search by clustering. How to implement e-errors search via overlap distance and k-grams. Prefix/suffix search via the Permuterm index. slides of previous lecture
29/10/24 Exercises
30/10/24 Dynamic Programming: fibonacci, edit distance, weighted edit distance, dynamic time warping. And exercises.
04/11/24 Exercises
05/11/24 Exercises and hands-on on the library FAISS
06/11/24 Exercises on the topics of the midterm exam
11/11/24 MIDTERM EXAM in Sala Seminari EST
12/11/24 Integer compression: Variable Byte and Gamma Code for posting list compression. Kraft inequality and the optimal length of an istantaneous code. Slides: part 1, part 2
13/11/24 Integer compression: Elias gamma and delta codes; description, analysis, coding and decoding examples. Sect. 11.1
18/11/24 Elias-Fano integer representation. Description, space usage analysis, operations Access and NextGEQ Sects. 11.6 and 15.1.2. Slides: Elias-Fano code
19/11/24 Elias-Fano integer representation: Python implementation. Code: Elias-Fano code
20/11/24 Substring search: suffix tries, suffix trees, suffix arrays. Sect. 10.1, 10.2, 10.3. Slides: suffix tries, suffix trees, suffix arrays
25/11/24 Python code for suffix tree construction and search. Exercise: finding repetitions on suffix trees Code: Suffix Tree class in Python
26/11/24 SA and LCP array construction from the suffix tree. Exercise: longest common substring using suffix tree or SA/LCP array Code: Suffix Tree class in Python (method `saLcp`)
27/11/24 The Burrows-Wheeler transform. Computation from the SA and inversion Sect. 14.1. Slides: bwt properties, Code: bwt computation and inversion
3/12/24 FM-index Sect. 14.5. Slides: BWT and FM-index
4/12/24 Wavelet Trees Sect. 14.5. Slides: Introduction to Wavelet Trees, Wavelet Trees for integer sequences
6/12/24 Exercises on FM-indices and Wavelet Trees
9/12/24 Exercises on the topics of the second part of the course
10/12/24 Exercises on the topics of the second part of the course
13/12/24 Final exam at 11 AM in room L1
⚠️ **GitHub.com Fallback** ⚠️