# Algorithms and Data Structures - Spring 2023

announcements
Mar 16: the midterm exam is scheduled for Tuesday 25 April at 10:30. More detailed instructions will follow.
Mar 6: Assignment n. 3: read and practice with the last two sections of the notes on Elementary Algorithmic Programming in Python entitled Arrays and Function Definitions.
Feb 27: Assignment n. 2: read and practice with the notes on Elementary Algorithmic Programming in Python, up to and including the Loops section.
Feb 21: Assignment n. 1: read and practice with the notes on Elementary Algorithmic Programming in Python, up to and including the Code Blocks section.
Feb 21: Welcome to Algorithms and Data Structures!
Instructor: Antonio Carzaniga
Assistants: Thomas Bertini,
Fabio Di Lauro, Bojan Lazarevski,
Shamiek Mangipudi, Claudio Milanesi
Lecture schedule: Tuesday 10:30–12:30, Thursday 10:30–12:30. See the course weekly schedule or the second-semester Bachelor schedule for details and updates
Instructors' Office Hours: by appointment
Assistants' Office Hours: by appointment

### Objectives

Algorithms and data structures are fundamental to computer science. They are the essence of computer programs. Also, the performance of any software system depends on the efficiency of its algorithms and data structures. Designing and analyzing algorithms is therefore crucial for the development of software systems. More generally, the study of algorithms provides insight into the nature of problems and their possible solutions, independent of programming language, programming paradigm, computer hardware, or any other implementation aspect. The objective of this course is to provide students with the knowledge and skills necessary to design and reason about algorithms, and to understand some of the most fundamental algorithms and data structures, their strengths and weaknesses, and their suitability in common contexts.

### Contents

The course will cover basic notions of complexity, including asymptotic analysis of worst-case and average complexity, big-O, little-o, omega, and theta notation, polynomial reductions, poly-time verification vs. solution, NP and P complexity classes; general algorithm strategies such as brute force, greedy, divide-and-conquer, and dynamic programming; common algorithms, including elementary numeric computations, searching and sorting, elementary graph algorithms, and string matching; basic data structures, including stacks, queues, linked lists, and rooted trees; more advanced data structures, including B-trees, heaps, hash tables, and structures representing disjoint sets and dictionaries.

### Lectures and Related Material

• An introduction to elementary, algorithmic programming in Python. This topic will be covered over a series of lectures.
• Course introduction: course organization and policies; Example of the Fibonacci sequence: a bad algorithm and a good algorithm; implementation-independent behaviors and algorithmic complexity.
• Complexity under the RAM model. Asymptotic growth of functions: big-O, Omega, and Theta notations.
• Basic elements for the analysis of algorithms: complexity and correctness of insertion-sort; worst-, best-, and average-case complexity; loop invariants.
• Divide and conquer strategy: binary search, merge, merge sort, recursive multiplication, median and k-smallest selection.
• Quick-sort. Heaps and heap-sort.
• Elementary data structures and hash tables.
• Binary search trees. Randomized binary search trees.
• Review or binary trees. Height of a BST in the average case: simulation and visualization.
• Red-Black trees: introduction.
• B-Trees. Data structures in secondary storage: modeling disk access. Structure, search, and insertion in B-trees. Relation with red-black trees.
• Graphs: representation and elementary algorithms.
• Minimal spanning trees; Disjoint sets.
• Dijkstra's Algorithm.
• Greedy algorithms: general strategy, activity selection, Huffman codes.
• Dynamic programming: examples, and general strategy.
• Basic elements of complexity theory: polynomial-time algorithms and problems; the P complexity class; the NP class; polynomial-time reduction and NP-completeness; satisfiability.
this page is maintained by Antonio Carzaniga and was updated on May 30, 2023