General Info

Teacher Philip, Office hours Monday + Thursday 12.30-13.00.

Exercise classes Thursdays 8.00-10.30.

Class Room Study line Type Teaching Assistant
1 308/exercise area 1. floor south BEng Group Work Marcus Pagh
2 308/exercise area 1. floor north BEng Group Work Mads Okholm Bjørn
3 324/040 (+ 308/aud. 12 kl. 10.00-10.30) BSc Group Work Marcus Skov Hansen
4 324/050 BSc Group Work Tord Joakim Stordalen
5 324/060 BSc Group Work Johan Bloch Madsen
6 324/020 BEng/BSc Presentation and Discussion Andreas Halkjær From

The areas in common area in 324 (F003, F004, F005) is also reserved for the course. See overview map of all exercise rooms in 308 and 324. Additionally, Thomas Søren Henney and Martin Hemmingsen will move around and help where needed.

Lectures Thursdays 10.45-12.00 in 116/aud. 81.

Materials "Introduction to Algorithms", 3rd edition (CLRS), Cormen, Leierson, Rivest og Stein + notes. We recommend getting a physical version of the book to bring to the exam. We encourage using supplementary books and other sources for algorithms. Se suggestions here.

CodeJudge We use CodeJudge for testing code. Access CodeJudge here.

Piazza We use Piazza for online discussions. Access Piazza here.


The weekplan is preliminary and may be updated during the course. The exercises class in week x covers the exercises on weekplan x-1.

Week Topics Slides Weekplan Material Algorithm Demos Programming Demos
0 Warmup: Preparation, Programming Prerequisites, and Puzzles. Warmup Survival Guide · Programming Prerequisites Factorial function
1 Basic Concepts I: Introduction, Algorithms, Data Structures, Top Points. 1x1 · 4x1 Introduction CLRS chap. 1 Recursive Peak Point Algorithm Peak Points
2 Basic Concepts II: Searching, Sorting. 1x1 · 4x1 Searching and Sorting CLRS chap. 2 Binary Search · Insertion Sort · Merge · Mergesort Binary Search
3 Basic Concepts III: Complexity, Asymptotic Notation, Empirical Analysis. 1x1 · 4x1 Analysis of Algorithms CLRS chap. 3
4 Data Structures I: Stack, Queues, Linked Lists, Trees. 1x1 · 4x1 Introduction to Data Structures CLRS intro to part III + chap. 10 Stack with Array · Queue with Array · Dynamic Array 1 · Dynamic Array 2 Linked List
5 Data Structures II: Priority Queues, Heaps. 1x1 · 4x1 Priority Queues and Heaps CLRS chap. 6 + appendix B.5 Bubble up and down Heap
6 Graph Algorithms I: Undirected Graphs, Representation, Searching, Modelling. 1x1 · 4x1 Introduction to Graphs CLRS intro to part VI + chap. 22.1-22.4 + appendix B.4-B.5. DFS · BFS DFS
7 Graph Algorithms II: Directed Graph, Topological Sorting, Implicit Graphs. 1x1 · 4x1 Directed Graphs CLRS intro to part VI + chap. 22.1-22.4 + appendix B.4-B.5. Topological Sort Topological Sort
8 Data Structures III: Union-Find, Dynamic Connected Components. 1x1 · 4x1 Union-Find CLRS chap. 21 except 21.4 + Algorithms, 4ed. chap. 1.5 Quick Union · Weighted Quick Union
9 Graph Algorithms III: Minimum Spanning Trees, Prims' Algorithm, Kruskal's Algorithm. 1x1 · 4x1 Minimum Spanning Trees CLRS chap. 23. Prims' Algorithm · Kruskal's Algorithm
10 Graph Algorithms IV: Dijkstra's Algorithm, Shortest Paths in Weighted Graphs, Shortest Paths in DAGs. 1x1 · 4x1 Shortests Paths CLRS chap. 24 except 24.1 and 24.4. Dijkstras' Algorithm
11 Data Structures IV: Dictionaries, Hashing. 1x1 · 4x1 Hashing CLRS chap. 11 except 11.5. Chained Hashing · Linear Probing
12 Data Structures V: Algorithm on Trees, Predecessor Problem, Binary Search Trees. 1x1 · 4x1 Binary Search Trees CLRS chap. 12 except 12.4. Binary Search Trees
13 Course Wrap-Up: Questions, Selected Exercises from an Old Exam, Advanced Courses in Algorithms.

Mandatory Exercises

The course has mandatory exercises that must be passed inorder to attend the final exam. There are two types of mandatory exercises:

Written exercises These exercises consist of algorithmic challenges that must be answered in writing. You need to hand these in to your teaching assistant who then evaluates them and provides oral feedback. There are 9 of these exercises and you need to pass at least 3 of them to meet the requirements for these exercise. The exercises appear on weekplans 1-9. The exercise on weekplan x must be handed in (on paper) to your teaching assistant during the exercise class in week x+1. Eventhough you only need to pass 3 out of 9 exercises, we highly recommend that you hand-in all of them and get feedback.

Your hand-ins for the written exercises should be short and precise. Most hand-ins can be answered optimally in 1-2 pages. The hand-in must clearly mark your name, student-id, and the name of the teaching assistant in your class. Do not make a titlepage and do not repeat the text of the exercise. We recommend that you use the following LaTeX-template template.tex to prepare your hand-in (see for an introduction to LaTeX).

Implementation exercises These exercises consist of 4 programming challenges that must be implemented and submitted to the CodeJudge system. You need to pass at least 2 of the exercises to meet the requirements for these exercises. The deadline for submitting the exercises is during exercise classes in week 10 (the same as the deadline for the last written exercise) but you can submit at any time before that. You can find the exercises here.

Collaboration policy All mandatory exercises are subject to the following collaboration policy. The exercises are individual. It is not allowed to collaborate on the exercises, except for discussing the text of the exercise with teachers and fellow students enrolled on the course in the same semester. Under no circumstances is it allowed to exchange, hand-over or in any other way communicate solutions or part of solutions to the exercises. It is not allowed to use solution from previous years, solutions from similar courses, or solutions found on the internet or elsewhere.

Old Exams

BSc BSc - Solved BEng BEng - Solved
02105-2009 02105-2009-solved
02105-2010 02105-2010-solved 02326-2010 02326-2010-solved
02105-2011 02105-2011-solved 02326-2011 02326-2011-solved
02105-2012 02105-2012-solved 02326-2012 02326-2012-solved
02105-2013 02105-2013-solved 02326-2013 02326-2013-solved
02105-2014 02326-2014
02105-2015 02326-2015

Frequently Asked Questions

What programming and mathematics requirements do I need for the course? In general, you need an introductory course in programming and mathematics. Specifically, for programming you need only basic constructions such as conditional execution, loop, function calls, etc. See the programming prequisites under week 0 to test your programming skills. You can freely choose among standard imperative programming languages for the implementation exercises. For mathematics, the course uses and introduces basic topics from discrete mathematics and hence it is an advantage to have a course in it, but not a requirement.

What is the language of the course? The official language of the course is Danish. Hence the spoken language and the exam is in Danish. Most of the course material is currently transitioning from Danish to English to prepare for a future English version of the course.

I need to quickly refresh my programming skills. What do you recommend? We suggest the book "Introduction to Programming in Java", Sedgewick and Wayne. The book is compact, concise, and focused on the core technical aspects of programming. The books covers essentially all relevant material for the course in chapter 1, which is freely available at the homepage for the book.

Which supplementary books/materials do you recommend? We suggest the following:

What does "give an algorithm" mean? It means, that you describe your solution in a short, precise, and unambigious manner, argue corretness of your solution, and analyse the complexity of your solution. Unless specified otherwise, the description should be in natural language and not pseudocode.

I get error X when I submit my program to CodeJudge. What should I do?/How do I find the bug?/Help! CodeJudge is for a final check of your code (does it produce the correct output for a given input (efficiently)?). To debug your code, construct small test examples and run them on your own computer.

I didn't make the deadline for a mandatory exercise. Can I hand in later? No. In special cases (e.g. illness) we can give an exemption. Talk to the course responsible during class or office hours.

Are there solutions to exercises? Yes! A large portion of the old exams have example solutions (see above).

When and where is the exam? Please see the DTU exam schedule.

I've successfully passed the mandatory assignments at an earlier point in time. Will I have to do them again? No. We highly encourage you to do them anyway to get feedback and practice.

How does the re-exam work? The precise format is subject to change depending on the number of students and the current rules. Typically, the exam and mandatory assignments are very similar to those in the regular semester.

How do I sign up for the re-exam? Please see the DTU pages for how to sign up for a course or exam or ask relevant staff.