29
HEINZ NIXDORF INSTITUTE University of Paderborn Algorithms and Complexity Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011

Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Welcome to the course

Algorithm Design

Friedhelm Meyer auf der Heide 1

Summer Term 2011

Friedhelm Meyer auf der Heide

Lecture 1, 8.4.2011

Page 2: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Organization

Familiarity with some basic algorithms and data structures and their analyses as presented in the course "Datenstrukturen und Algorithmen" is assumed.

The lecture and tutorials will be given in English. (The German title of this course is “Methoden des Algorithmenentwurfs”.)

Friedhelm Meyer auf der Heide 2

Lecture Friday 11:15 - 13:00 F0.530 Tutorial I Friday 10:15 - 11:00 F2.211 (Ralf Petring)Tutorial II Friday 13:15 - 14:00 F2.211 (Ralf Petring)

Exercises will be available on Wednesday afternoon. Return deadline is next weeks Thursday at 10 am. The solutions can be sent via e-mail (only PDF documents are accepted) to Ralf Petring or dropped at F1.203.

Page 3: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Examination

Oral examinations of 20 minutes duration. The exams will cover the lecture and also the tutorials and homework exercises.

You need at least 30% of the total number of points in the homework exercises for the admission to exam.

Bonus Scheme

You can improve your grade by actively participating in the weekly tutorials and

Friedhelm Meyer auf der Heide 3

You can improve your grade by actively participating in the weekly tutorials andsuccessfully solving the weekly homework exercises. For achieving at least 50 % of the total number of points in the homework exercises, your grade will improve by 1/3, for achieving at least 75 %, your grade will improve by 2/3. This only applies if you pass the examination.

Module Information

Module II.2.1 Modelle und Algorithmen (Models and algorithms)V2 + Ü1 SWS4 ECTS credits (workload)

Page 4: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Topics

- Divide & conquer

- Dynamic programming

- Greedy Algorithms

- Randomized Algorithms

- Approximation Algorithms

Friedhelm Meyer auf der Heide 4

- Approximation Algorithms

- Online Algorithms

Page 5: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Asymptotic Runtime Analysis

Friedhelm Meyer auf der Heide 5

Page 6: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

The O-Notation

Friedhelm Meyer auf der Heide 6

Page 7: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

The O-Notation

Friedhelm Meyer auf der Heide 7

Page 8: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

The O-Notation

Friedhelm Meyer auf der Heide 8

Page 9: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Chapter 1:

Divide & Conquer

Friedhelm Meyer auf der Heide 9

Divide & Conquer

Page 10: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer

Divide the problem in a number of smaller subproblems.

Conquer the subproblems by solving them recursively.

Combine the results of the subproblem into a solution of the original problem.

Friedhelm Meyer auf der Heide 10

of the original problem.

Page 11: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer: Integer Multiplication

The school method needs Θ(n2) operations.

Divide the problem in a number of smaller subproblems.Conquer the subproblems by solving them recursively.

Combine the results of the subproblem into a solution of the original problem.

Friedhelm Meyer auf der Heide 11

Page 12: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer: Integer Multiplication

Divide the problem in a number of smaller subproblems.Conquer the subproblems by solving them recursively.

Combine the results of the subproblem into a solution of the original problem.

Friedhelm Meyer auf der Heide 12

If n=1: c = a0×b0

If n>1: c = A0×B0 + (A0×B1 + B0×A1)×2k + A1×B1×22k

Cost measure: # bit operations

T(1) = 1, For n>1, n a power of 2: T(n)=4 T(n/2) + αααα n

Thus T(n) = O(n²) � no improvement

Multiplications with powers of 2 (shifts) and additions.

Page 13: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

The Karazuba-Offman algorithm for integer multiplication, 1961

Friedhelm Meyer auf der Heide 13

Cost measure: # bit operations

T(1) = 1For n>1, n a power of 2: T(n) ≤ 3 T(n/2 + 1) + αααα n

Thus T(n) = O(nlog2(3) ) ~ O(n1.58 ) � improvement !!!

Multiplications with powers of 2 (shifts) and additions.

Page 14: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

A master theorem

Theorem: Let a, c > 0, b>1, be integer constants. Let T: N → N be recursively defined by

T(1) ≤ c, and for n > 1, n a power of b: T(n) ≤ a T(n/b) + cn

Then, for- a < b: T(n) ≤ cb/(b-a) n

a b c

Friedhelm Meyer auf der Heide 14

- a = b: T(n) ≤ cn (logb(n) + 1) = O(n log(n))

- a > b: T(n) ≤ ca/(a-b) nlogb(a)

Proof: Homework

Page 15: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer: Closest Pair

Friedhelm Meyer auf der Heide 15

Page 16: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer: Closest Pair

Friedhelm Meyer auf der Heide 16

Page 17: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer: Closest Pair

Friedhelm Meyer auf der Heide 17

Page 18: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer: Closest Pair

Friedhelm Meyer auf der Heide 18

Page 19: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer: Closest Pair

Friedhelm Meyer auf der Heide 19

Page 20: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer: Closest Pair

Friedhelm Meyer auf der Heide 20

Page 21: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer: Closest Pair

Friedhelm Meyer auf der Heide 21

Page 22: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer: Closest Pair

Friedhelm Meyer auf der Heide 22

Page 23: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer: Closest Pair

Friedhelm Meyer auf der Heide 23

Page 24: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Divide & Conquer: Closest Pair

Friedhelm Meyer auf der Heide 24

Page 25: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Friedhelm Meyer auf der Heide 25

Page 26: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Friedhelm Meyer auf der Heide 26

Page 27: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Friedhelm Meyer auf der Heide 27

Page 28: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Friedhelm Meyer auf der Heide 28

Page 29: Algorithm Design · Welcome to the course Algorithm Design Friedhelm Meyer auf der Heide 1 Summer Term 2011 Friedhelm Meyer auf der Heide Lecture 1, 8.4.2011. HEINZ NIXDORF INSTITUTE

HEINZ NIXDORF INSTITUTE

University of PaderbornAlgorithms and Complexity

Thank you for your attention!Thank you for your attention!

Friedhelm Meyer auf der Heide 29

Friedhelm Meyer auf der Heide

Heinz Nixdorf Institute

& Computer Science Department

University of Paderborn

Fürstenallee 11

33102 Paderborn, Germany

Tel.: +49 (0) 52 51/60 64 80

Fax: +49 (0) 52 51/62 64 82

E-Mail: [email protected]

http://www.upb.de/cs/ag-madh

your attention!your attention!