GithubHelp home page GithubHelp logo

algolab2018-1's Introduction

Algorithms Lab 2018

This repo contains my solutions to the algorithms lab of ETH Zürich. The lab consists of problems every week that must be solved via an algorithm.

The primary language to solve the challenges is C++. I strive as much as possible to document my code and my algorithms. The description of the problems may be wonky, so I suggest that you give the associated PDF a read for a detailed explanation of the problem.

Overview

WeekProblemScoreSolution
1Even Pairs100Partial Sums
1Build The Sum100Common Sense
1Dominoes100Sliding over the dominoes
1Even Matrices70Precomputation
PotW 1Deck of Cards100Precomputation + sliding window
2Burning Coins100Dynamic Programming
2Beach Bars100Sliding Windowm & DP
2The Great Game100Bottom Up Dynamic Programming
2Search Snippets75Sliding Windowm
PotW 2Magician and the Coin100Dynamic Programming & Memoization
3Hit100CGAL intersection testing
3First Hit99CGAL intersection testing
3Antenna100CGAL Min Circle
3Almost Antenna100CGAL Min Circle and Support Points
PotW 3Defensive Line100Dynamic Programming
4First Steps with BGL100MST and Dijkstra Shortest Paths
4Ant Challenge100MST and Dijkstra Shortest Paths
4Important Bridges100Biconnected Components
4Buddy Selection100Set Intersection & Group Matching
4Shortest Paths100Dijkstra
PotW 4Hiking Maps100CGAL Predicate Testing & Sliding Window
5Boats100Greedy Algorithm
5Attack of the Clones0-
5Light at the Museum100Split & List
5Punch0-
5High School Teams0-
PotW 5Planet Express100Shortest Paths & Vertex Aggregation
6Coin Tossing100Flow Computation
6Shopping Trip100Flow Computation
6Kingdom Defence100Flow Computation with min/max per edge
6Tetris100Flow Computation & Vertex splitting
Potw 6Octopussy100Greedy Algorithm
7Maximum100CGAL LP/QP
7Diet100QP
7Portfolios100QP
7Inball100CGAL LP - have to set up right LP
PotW 7London100Flow Computation & Vertex Aggregation
8Graypes100Triangulation
8Bistro100Triangulagion
8H1N1
8Germs
PotW 8Suez100LP
8Satellites
8Algocoon
8Real Estate Market
8Canteen
8Marathon
PotW 9GoldenEye100CGAL Proximity Structure (Vornoi)
9New Tiles
9On Her Majesty’s Secret Service
9Light the Stage
9Evolution
9Return of the Jedi
9Poker Chips
PotW 10India
10The Empire Strikes Back
10Planks
10Carsharing
10San Fransisco
PotW 11New York
11Light Pattern
11Casino Royale
11Radiation
11Hong Kong
PotW 12World Cup
12Bob’s Burden
12Corbusier
12Cantonal Courier
12Clues
12Moving Blocks
PotW 13Fleetrace

Compilation and Running

STL/BGL Files

To compile the cpp files:

g++ -Wall -O3 filename.cpp -o filename.o

To run the file with a given input and redirect output to a file

./filename.o < testsets/test{i}.in > test{i}.out

To compare with the expected output, use `diff`

diff test{i}.out testsets/test{i}.out

Alternatively, you can do the previous in one line

diff <(./filename.o < testsets/test{i}.in) testsets/test{i}.out

CGAL

Compiling CGAL files is slightly different, it makes use of the cgal_create_cmake_script. In order to avoid to seperate the source code from compiled files, take advantage of an additional build folder. Compile as follows:

cgal_create_cmake_script
mkdir build && cd build
cmake ..
make

To run, the procedure is the same as for STL/BGL files.

algolab2018-1's People

Contributors

kodefish avatar

Stargazers

jkan avatar

Watchers

 avatar

Forkers

wujiduan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.