Skip to content

Solutions for problems given in ETH course Algorithms Lab in Fall 2020

Notifications You must be signed in to change notification settings

simon-hrabec/Algolab-2020

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algolab 2020

Solutions for problems given in ETH course Algorithms Lab in Fall 2020. I was excplicitely disallowed to share the problems descriptions. If you want to get them try emailing the responsible faculty members or Googling to find it elsewhere.

The code for these problems is written with the following in mind:

  • Readability. It is prevalent in competitive programming to use macros, and extremely dense and unreadable code. I dont find the price for longer names and few more lines too high. I often rewrite the problems to try something new or to see performance gain/loss therefore even I appreciate this.
  • Performance. Lot of the problems could be solved with considerably less code. It would pass within the time limits. However, I tried to make the code run fast to a reasonable extent.
  • Code quality. I know this is competitive programming and it does not matter much here but I found out I do better when I go a bit slower in terms of writing code and then avoid some of small bugs/issues. This is the main reason why you can see const everywhere and special function to load data (to have the loaded data also const).

In case you find any kind of typo, bug, possible improvement, suboptimal solution, wrong explanation or anything else noteworthy do not hesitate to message me at my email simon.hrabec on gmail or get in touch via other means.

How to use this repository:

  • Check code snippets to get an idea how to use certain libraries.
  • If you get stuck and you already gave the problem some time, read the minimal amount of problem solution to get yourself unstuck.
  • After finishing the task check the solutions for alternative ways to approach it
  • Check the code if you just wanna compare the code of your solution and see how other people write C++.
  • Compare your running time to mine to see how efficient your code is.

Featured solutions - ordered by weeks

Week Problem of the Week 1st problem 2nd problem 3rd problem 4th problem
1 Build the Sum Dominoes Even Matrices Even Pairs
2 Deck of Cards Beach Bars Burning Coins Search Snippets The Great Game
3 From Russia with Love Antenna First Hit Hiking Maps Hit
4 Defensive Line Ant Challenge Buddy Selection First steps with BGL Important Bridges
5 Motorcycles Asterix the Gaul Attack of the Clones Boats San Francisco
6 Tracking Kingdom Defence Knights Shopping Trip Tiles
7 Octopussy Diet Inball Radiation What is the Maximum
8 Surveillance Photograph Bistro Clues Germs H1N1
9 Legions Algocoon Group Casino Royale Placing Knights Real Estate Market
10 Idefix Asterix and the Chariot Race Asterix in Switzerland New York Worldcup
11 Fleetrace Fighting Pits of Meereen Hand Lestrade Return of the Jedi
12 The Iron Islands Car Sharing Hong Kong India Moving Books
13 On Her Majestys Secret Service Evolution Marathon Punch Sith

Featured solutions - ordered by technique/algorithm/data structure

Code snippets

One of the most annoying thing about ALGOLAB (after the hard thinking ^^) is to always copy paste the right definitions for boost graphs, CGAL LP or flow edge adder. For this reason I put together a small set of useful snippets that should cover all your basic needs. It shoud prevent you from always searching the lecture notes or code examples for the relevant lines or going to the CGAL docs for basic syntax. You should find it here at one place. Some of the snippets are in fact the code from lectures or code examples (modified to some extent), some are written from scratch. The all attributions are listed in the code snippet descriptions.

About

Solutions for problems given in ETH course Algorithms Lab in Fall 2020

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages