Algorithm Theory - Exercise Class

Similar documents
Flow Network. The following figure shows an example of a flow network:

Chapter 5 Data Structures Algorithm Theory WS 2017/18 Fabian Kuhn

CMPSCI 611: Advanced Algorithms

Dominating Set. Chapter 26

Dominating Set. Chapter Sequential Greedy Algorithm 294 CHAPTER 26. DOMINATING SET

Two Applications of Maximum Flow

Algorithms: COMP3121/3821/9101/9801

CSC 373: Algorithm Design and Analysis Lecture 12

Algorithm Design CS 515 Fall 2015 Sample Final Exam Solutions

directed weighted graphs as flow networks the Ford-Fulkerson algorithm termination and running time

Dominating Set. Chapter 7

Discrete Wiskunde II. Lecture 5: Shortest Paths & Spanning Trees

1 Review for Lecture 2 MaxFlow

University of New Mexico Department of Computer Science. Final Examination. CS 561 Data Structures and Algorithms Fall, 2006

Another way of saying this is that amortized analysis guarantees the average case performance of each operation in the worst case.

Machine Learning: Exercise Sheet 2

We say that a flow is feasible for G (or just feasible if the graph and capacity function in question are obvious) if

Max Flow: Algorithms and Applications

Algorithms: Lecture 12. Chalmers University of Technology

CS 170 Algorithms Fall 2014 David Wagner MT2

Algorithm Design and Analysis

CMPS 6610 Fall 2018 Shortest Paths Carola Wenk

Flows and Cuts. 1 Concepts. CS 787: Advanced Algorithms. Instructor: Dieter van Melkebeek

CS599: Convex and Combinatorial Optimization Fall 2013 Lecture 17: Combinatorial Problems as Linear Programs III. Instructor: Shaddin Dughmi

4.8 Huffman Codes. These lecture slides are supplied by Mathijs de Weerd

Single Source Shortest Paths

CPSC 320 Sample Final Examination December 2013

Single Source Shortest Paths

Midterm 1 for CS 170

The min cost flow problem Course notes for Optimization Spring 2007

CS1800: Mathematical Induction. Professor Kevin Gold

INF2220: algorithms and data structures Series 1

Examination paper for TDT4120 Algorithms and Data Structures

Algorithms Exam TIN093 /DIT602

10 Max-Flow Min-Cut Flows and Capacitated Graphs 10 MAX-FLOW MIN-CUT

Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik. Combinatorial Optimization (MA 4502)

Lecture 2: Network Flows 1

25. Minimum Spanning Trees

Maximum Flow. Jie Wang. University of Massachusetts Lowell Department of Computer Science. J. Wang (UMass Lowell) Maximum Flow 1 / 27

25. Minimum Spanning Trees

Math 391: Midterm 1.0 Spring 2016

Shortest Path Algorithms

Lecture 6 September 21, 2016

2.13 Maximum flow with a strictly positive initial feasible flow

Problem. Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26

Analysis of Algorithms. Outline 1 Introduction Basic Definitions Ordered Trees. Fibonacci Heaps. Andres Mendez-Vazquez. October 29, Notes.

CS 61B Asymptotic Analysis Fall 2017

MAS210 Graph Theory Exercises 5 Solutions (1) v 5 (1)

The min cost flow problem Course notes for Search and Optimization Spring 2004

Ch01. Analysis of Algorithms

Lecture 3: String Matching

CSE 202 Homework 4 Matthias Springer, A

Types of Networks. Internet Telephone Cell Highways Rail Electrical Power Water Sewer Gas

Energy minimization via graph-cuts

Prelim 2[Solutions] Solutions. 1. Short Answer [18 pts]

Tutorial 4. Dynamic Set: Amortized Analysis

Lecture 5 January 16, 2013

CS Analysis of Recursive Algorithms and Brute Force

Discrete Optimization 2010 Lecture 2 Matroids & Shortest Paths

Sorting. CS 3343 Fall Carola Wenk Slides courtesy of Charles Leiserson with small changes by Carola Wenk

AMORTIZED ANALYSIS. binary counter multipop stack dynamic table. Lecture slides by Kevin Wayne. Last updated on 1/24/17 11:31 AM

CS675: Convex and Combinatorial Optimization Fall 2014 Combinatorial Problems as Linear Programs. Instructor: Shaddin Dughmi

Advanced Analysis of Algorithms - Midterm (Solutions)

COL351: Analysis and Design of Algorithms (CSE, IITD, Semester-I ) Name: Entry number:

Allocate-On-Use Space Complexity of Shared-Memory Algorithms

6.046 Recitation 11 Handout

Discrete Optimization 2010 Lecture 3 Maximum Flows

Maximum Flow Problem (Ford and Fulkerson, 1956)

Randomized Sorting Algorithms Quick sort can be converted to a randomized algorithm by picking the pivot element randomly. In this case we can show th

Recursion and Induction

MA015: Graph Algorithms

CSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: Oct 26. Homework #2. ( Due: Nov 8 )

CMPSCI 311: Introduction to Algorithms Second Midterm Exam

Search and Lookahead. Bernhard Nebel, Julien Hué, and Stefan Wölfl. June 4/6, 2012

CS 4407 Algorithms Lecture: Shortest Path Algorithms

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005

Dijkstra s Single Source Shortest Path Algorithm. Andreas Klappenecker

22 Max-Flow Algorithms

Weighted Activity Selection

Lecture Notes for Chapter 25: All-Pairs Shortest Paths

Ch 01. Analysis of Algorithms

8 Priority Queues. 8 Priority Queues. Prim s Minimum Spanning Tree Algorithm. Dijkstra s Shortest Path Algorithm

Algorithms. Algorithms 2.4 PRIORITY QUEUES. Pro tip: Sit somewhere where you can work in a group of 2 or 3

Midterm Exam 2 Solutions

CMPSCI611: The Matroid Theorem Lecture 5

Week 5: Quicksort, Lower bound, Greedy

COMP 382: Reasoning about algorithms

Sorting. CMPS 2200 Fall Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18

C&O 355 Mathematical Programming Fall 2010 Lecture 18. N. Harvey

CMSC 451: Lecture 7 Greedy Algorithms for Scheduling Tuesday, Sep 19, 2017

Today: Amortized Analysis

MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 3

1. Problem I calculated these out by hand. It was tedious, but kind of fun, in a a computer should really be doing this sort of way.

Fibonacci (Min-)Heap. (I draw dashed lines in place of of circular lists.) 1 / 17

Amortized analysis. Amortized analysis

Lecture 2: Just married

Static Program Analysis

Graph Theory and Optimization Computational Complexity (in brief)

Introduction to Algorithms

Transcription:

Algorithm Theory - Exercise Class Exercise Lesson 3 Albert-Ludwigs-Universität Freiburg Philipp Schneider Algorithms and Complexity - Professor Dr. Fabian Kuhn

Organizational Matters English Tutorial in Room 101-02-016/18. Next exercise by Mohamad Ahmadi in English and in this room. Email subject: AlgoTheo1718_[Sheet-Number]

Pseudocode: Standard Operating Procedure Do not program Most of the time you don t need...... classes... subprocedures for easy tasks (describe them instead)... subprocedures replicating mathematical operations e.g. { f (x)} x Set... brackets around forks, loops Algorithm Theory Software Engineering Concentrate on your strategy Emphasis on the analysis of correctness and runtime Neglect implementation details, wherever possible It s perfectly fine to describe an algorithm with text

MIS vs maxis Let G = (V,E) be a graph. V V independent if for any nodes u,v V it holds that {u,v} / E. V maximal independent (MIS) if V is independent and there can no node be added without violating independence. V maximum independent (maxis) if V is independent and V is maximum among all independent sets of G.

Greedy - MaxIS Devise an efficient algorithm that computes a maximum independent set in a rooted tree (for node v let C(v) := children of v in T ). Algorithmus 1 : GreedyTreeMaxIS(v,T ) for u C(v) do GreedyTreeMaxIS(u,T ) if u C(v) : u / S then add v to S // S global

Dynamic Programming - MaxIS Devise an efficient algorithm that that uses dynamic programming and computes the size of a maximum independent set in a rooted tree. { } s(v) = max s(u), 1 + s(w) u C(v) u C(v) w C(u) Algorithmus 2 : TreeMaxIS(v) if memo[v] then return memo[v] c u C(v) TreeMaxIS(u) g 1 + u C(v) w C(u) TreeMaxIS(w) memo[v] max{c, g} return memo[v]

Exercise 1: Dynamic Programming - MaxIS (a) Devise an efficient algorithm that uses the principle of dynamic programming and finds a maximum independent set in a rooted tree. Algorithmus 3 : TreeMaxIS(v) if memo[v] then return memo[v] c u C(v) TreeMaxIS(u) g 1 + u C(v) w C(u) TreeMaxIS(w) if g > c then add v to maxis memo[v] max{c, g} return memo[v]

Exercise 1: Dynamic Programming - MaxIS (b) Prove that your algorithm is correct, i.e. returns a maximum independent set and prove that it has the claimed runtime.

Worst Case Analysis - Fibonacci Heaps Show that in the worst case (a) the delete-min operation can require time Ω(n) for an arbitrary n.

Worst Case Analysis - Fibonacci Heaps Show that in the worst case (b) the decrease-key operation can require time Ω(n) for an arbitrary n.

Amortized Analysis - Counting We execute n increment operations on a binary number starting from 0. Flipping the i th bit b i now has a cost 2 i. (a) Show that the amortized cost is super-constant (i.e. in ω(1)).

Amortized Analysis - Counting We execute n increment operations on a binary number starting from 0. Flipping the i th bit b i now has a cost 2 i. (b) Show that the amortized cost is O(logn).

Graph Algorithms: Max-Flow Consider the Max-Flow Problem of a directed graph G = (V,E) with capacities c : E N 0. Instead of just one source and one sink, you are given k sources s 1,...,s k and l sinks t 1,...t l. The flow function f : E N 0 must satisfy the properties Capacity constraints: f (e) c(e), for all e E Flow Conservation: f (e) = f (e), for all v V \ {s 1,...,s k,t 1,...,t l } e into v e out of v The value of a flow is f = k i=1 e out of s i f (e) = l j=1 e into t j f (e) Show that you can reduce this problem in order to solve it with conventional means (e.g. the algorithm of Ford-Fulkerson from the lecture).

Graph Algorithms: Max-Leaky-Flow Consider the Max-Flow problem with one source s and one sink t, but each node leaks an amount of 1 unit. This means that if c is flowing into v then only max(0,c 1) is flowing out. The leaking flow is counted towards the value of the flow, though. Can you reduce this problem as well?