**Teachers**

- Philip Bille, phbi@dtu.dk, Office hours Monday + Thursday 12.30-13.00.

**Exercise classes** Thursdays 8.00-10.00.

Class | Room | Study line | Type | Teaching Assistant |
---|---|---|---|---|

1 | 308/exercise area 1. floor south | BEng | Group Work/Danish | Marcus Pagh |

2 | 308/exercise area 1. floor north | BEng | Group Work/Danish | Katrine Thoft |

3 | 324/020 | BEng/BSc | Presentation and Discussion/English | Simon Søkilde |

4 | 324/030 | BSc | Group Work/English | Tord Joakim Stordalen |

5 | 324/040 (+ 303/aud. 43 at 10.00-10.30) | BSc | Group Work/Danish | Mads Okholm Bjørn |

6 | 324/050 | BSc | Group Work/Danish | Benjamin Lam |

7 | 324/060 | BSc | Group Work/Danish | Johan Bloch Madsen |

**Lectures** Thursdays 10.00-12.00

**Materials** "Introduction to Algorithms", 3rd edition (CLRS), Cormen, Leierson, Rivest, and 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.

**Piazza ** We use Piazza for online discussions.

**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, Peaks. | 1x1 · 4x1 | Introduction | CLRS chap. 1 | Recursive Peak Algorithm | Peaks |

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. |

The course has mandatory exercises that must be passed inorder to attend the final exam. The mandatory exercises consist of written and implementation exercises:

**Written exercises** These are algorithmic challenges that must be answered in writing. These must be handed through Gradescope for correction by the TA's. Each weekly exercise is scored between 0 and 20 points, depending on the quality of your solution and your writing. It is a requirement for participation in the exam that you score at least xx points in total in the exercises.

**Implementation exercises**
These are programming challenges that must be implemented and handed in through CodeJudge for automatic evaluation. It is a requirement for participation in the exam that you pass at least xx of these exercises.

**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.

BSc | BEng |
---|---|

02105-2017 | 02326-2017 |

**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 English. Hence the spoken language in lectures and the exam is in English. There are Danish exercise classes and your are free to hand in mandatory exercise and the exam in Danish.

** 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:

- "Algorithm Design", Kleinberg and Tardos. Focus on algorithm design. Lacks some of data structures covered in the course.
- "Algorithms", Sedgewick and Wayne. Focus on implementation and many code examples.
- "Data structures and algorithms in Java", Goodrich and Tamassia.
- Lots of video lectures (of varying quality) are available online. One of the better is MIT's "Introduction to Algorithms" by Erik Demaine and Charles Leiserson. This course (of course) also uses CLRS. Note that this course is significantly larger than Algorithms and Data Structures (1) and covers many more subjects.

**What does "give an algorithm" mean?**
It means, that you describe your solution in a short, precise, and unambigious manner, argue correctness of your solution, and analyze 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.

**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 but did no pass the corresponding exam. Will I have to do mandatory exercises again to attend another exam?**
Yes. A new set of mandatory exercises must be succesfully passed in the period immediately before an exam. This is highly relevant preparation for the exam and if you are unable to solve the mandatory exerices you are likely unable to pass the exam.

**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.