# Design and Analysis of Algorithms: 2021-2022

| |

| Preliminary Examinations — Computer Science and Philosophy |

| Hilary Term 2022 (16 lectures) |

## Overview

This core course covers good principles of algorithm design, elementary analysis of algorithms, and fundamental data structures. The emphasis is on choosing appropriate data structures and designing correct and efficient algorithms to operate on these data structures.

## Learning outcomes

This is a first course in data structures and algorithm design. Students will:

- learn good principles of algorithm design;
- learn how to analyse algorithms and estimate their worst-case and average-case behaviour (in easy cases);
- become familiar with fundamental data structures and with the manner in which these data structures can best be implemented; become accustomed to the description of algorithms in both functional and procedural styles;
- learn how to apply their theoretical knowledge in practice (via the practical component of the course).

## Synopsis

- Program costs: time and space. Worst case and average case analysis. Asymptotics and "big O" notation. Polynomial and exponential growth. Asymptotic estimates of costs for simple algorithms. Use of induction and generating functions. [2]
- Algorithm design strategies: top down design, divide and conquer. Application to sorting and searching and to matrix algorithms. Solution of relevant recurrence relations. [4]
- Data structures and their representations: arrays, lists, stacks, queues, trees, heaps, priority queues, graphs. [3]
- Introduction to discrete optimisation algorithms: dynamic programming, greedy algorithms, shortest path problems. [3]
- Graph algorithms: examples of depth-first and breadth-first search algorithms. Topological sorting, connected components. [3]

## Syllabus

Basic strategies of algorithm design: top-down design, divide and conquer, average and worst-case criteria, asymptotic costs. Simple recurrence relations for asymptotic costs. Choice of appropriate data structures: arrays, lists, stacks, queues, trees, heaps, priority queues, graphs. Applications to sorting and searching, matrix algorithms, shortest-path and spanning tree problems. Introduction to discrete optimisation algorithms: dynamic programming, greedy algorithms. Graph algorithms: depth first and breadth first search.

## Lectures

- Program cost and asymptotic analysis - slides
- Divide-and-conquer - slides
- Data structures - heaps - slides
- Dynamic programming - slides
- Graph search - slides
- Shortest path - slides
- Greedy algorithm - slides
- Matroids - slides
- Stable matching - slides

## Problem Sheets

There will be 4 sets of problems.

- Problem sheet 1 (answers to *-problems)
- Problem sheet 2 (answers to *-problems)
- Problem sheet 3 (answers to *-problems)
- Problem sheet 4 (answers to *-problems)

## Practical materials

## Reading list

- T. H. Cormen, C. E. Leiserson, R. L. Rivest and C. Stein.
*Introduction to Algorithms*, 3rd edition, MIT Press, 2009 (2nd edition [2001] or 1st edition, [1990] can be used as well). This is the main text book for this lecture course. - J. Kleinberg and E. Tardos.
*Algorithm design*. Addison-Wesley. First edition 2005, 2nd edition February 2022. - S. Dasgupta, C. Papadimitriou, and U. Vazirani.
*Algorithms*. McGraw-Hill Higher Education. 2006

## Feedback

Students are formally asked for feedback at the end of the course. Students can also submit feedback at any point here. Feedback received here will go to the Head of Academic Administration, and will be dealt with confidentially when being passed on further. All feedback is welcome.