Algorithms and Data Structures - Spring 2022

May 10: The second graded homework assignment is out. The submission deadline is Tuesday May 17 at 22:00.
Apr 26: How many countries can you walk to starting from Switzerland? What is the least number of land borders you have to cross to go from South Africa to Switzerland? Answer these questions by writing two python programs that read the list of land border between countries from this text file> (encoded in an intuitive way).
Apr 26: The following are good exercises about binary search trees, taken as usual from the collection of exam exercises (Edition 2.11): 200, 95, 96, 81, 195. You might want to work these out and discuss your solutions in Thursday's exercise session (April 28).
Mar 27: The first graded assignment is out. Submission deadline is Monday April 4 at 22:00.
Mar 23: The midterm exam is scheduled for Thursday 7 April from 14:30 to 16:30.
Mar 23: The following are good exercises for the midterm exam, taken as usual from the collection of exam exercises (Edition 2.11): 100, 101, 102, 103, 105, 114, 115, 116, 117, 118, 122, 125, 126, 129, 130, 135, 142, 144, 145, 149, 150, 152, 154, 156, 161, 162, 164, 165, 177, 178, 179, 180, 181, 182, 183, 184, 187, 190, 192, 194, 196, 197, 199, 204, 207, 210, 211, 212, 213, 214.
Have at it!
Mar 23: Room C1.04 (the usual classroom) is reserved for exercise sessions for the Thursday 14:30-16:30 slot for the rest of the semester. We will use this time and space to work, individually, in groups, and all together, on algorithmic programming and exercises. The first exercise session will be held next week, on Thursday 31 March. We will work on exercises 100, 101, 102, 103, 105 from the collection of exam exercises.

Attendance is not at all required, although I encourage everyone to participate.

Mar 10: There will be an exercise session during next week's Tuesday class (15 March). You should prepare by solving the following exercises on your own before Tuesday:
  • Horizontal Histogram from this list of Python programming exercises.
  • Vertical Histogram from this list of Python programming exercises.
  • Compression of a Sequence from this list of Python programming exercises.
  • Exercise n. 172 from this collection of exam exercises.
Mar 2: Unfortunately, I have to cancel tomorrow's class (Thursday, 3 March). I prepared three simple programmig exercises in Python. You should use the two hours of class time to practice with those. We will discuss the solutions in class next week.
Feb 28: Reading assignment (3): Read again>, and practice again and again> with the Notes on Elementary Algorithmic Programming in Python, al least through the Arrays section. Do this before the lecture of Thursday 3 March.
Feb 24: Reading assignment (2): Read again, and practice again and again with the Notes on Elementary Algorithmic Programming in Python, al least through the Loops section. Do this before the lecture of Tuesday 1 March.
Feb 22: Assignment n. 1: read and practice with the notes on Elementary Algorithmic Programming in Python, up to and including the CodeBlocks section.
Feb 22: Welcome to Algorithms and Data Structures!
Instructor: Antonio Carzaniga
Assistants: Dylan Robert Ashley, Aditya Ramesh, Morteza Rezaalipour.
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


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.


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.


Useful Links

Additional information is available through the following links and pages.

Lectures and Material

this page is maintained by Antonio Carzaniga and was updated on June 07, 2022