29
Computational Complexity Lecture 1 February 5, 2020 Universiteit van Amsterdam

Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

  • Upload
    others

  • View
    3

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Computational Complexity

Lecture 1

February 5, 2020Universiteit van Amsterdam

Page 2: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Practical Information

I Ronald de Haan ([email protected])

I Boas Kluiving ([email protected])

I Course web page:https://staff.science.uva.nl/r.dehaan/complexity2020/

I Canvas page: https://canvas.uva.nl/courses/10928

I Book: Computational Complexity: A Modern Approach,by Sanjeev Arora & Boaz Barak, 2009.(http://www.cs.princeton.edu/theory/complexity/)

Page 3: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

What is Computational Complexity?

I The study of what you can compute with limited resources

I Resources, e.g.: time, memory space, random bits

I Computability theory tells us what can be computed in principle

Computational complexity theory tells us what can becomputed realistically

I Central notions:I The resource use of an algorithm, in the worst caseI Computational problems, and algorithms solving these problemsI How does the resource use of algorithms scale?I ...

Page 4: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

What is Computational Complexity?

I Distinguish different degrees of computational difficulty:

different complexity classes

(a whole zoo of complexity classes:https://complexityzoo.uwaterloo.ca/Complexity_Zoo)

I Central question: the P versus NP problem(one of the $1 Million Millennium Prize Problems)

Page 5: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

What is Computational Complexity?

I Distinguish different degrees of computational difficulty:

different complexity classes

(a whole zoo of complexity classes:https://complexityzoo.uwaterloo.ca/Complexity_Zoo)

I Central question: the P versus NP problem(one of the $1 Million Millennium Prize Problems)

Page 6: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Relation to Other Fields

I Computation plays a role nearly everywhere..

I Therefore, computational complexity is relevant for many areas;for example:

I Computer scienceI CryptographyI Economics, game theoryI Artificial intelligenceI BiologyI Scheduling, vehicle routingI . . .

Page 7: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Some courses that are related

I Recursion Theory

I Kolmogorov Complexity

I Knowledge Representation and Reasoning

I Quantum Computing

I Machine Learning Theory

I Computational Social Choice

Page 8: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Illustration: Graph k-Coloring

I You are given an undirect graph

I Nodes / vertices, with edges between them.

I The task is to color each node with a color in {1, 2, . . . , k} sothat no two connected nodes have the same color

I This can be used to model many applications

I For example, nodes are regions with their own radio station,colors are radio frequencies, and two nodes are connected if theregions border each other

I The task is to assign radio frequencies without conflict (in theborder areas)

Page 9: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Illustration: Graph k-Coloring

I You are given an undirect graph

I Nodes / vertices, with edges between them.

I The task is to color each node with a color in {1, 2, . . . , k} sothat no two connected nodes have the same color

I This can be used to model many applications

I For example, nodes are regions with their own radio station,colors are radio frequencies, and two nodes are connected if theregions border each other

I The task is to assign radio frequencies without conflict (in theborder areas)

Page 10: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Color this graph with 2 colors!

Page 11: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Color this graph with 2 colors!

Page 12: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Now, color this graph with 3 colors!

Page 13: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps251020501001000

I # of atoms in universe ≈ 1080

Page 14: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec51020501001000

I # of atoms in universe ≈ 1080

Page 15: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec51020501001000

I # of atoms in universe ≈ 1080

Page 16: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec5 0.15 msec1020501001000

I # of atoms in universe ≈ 1080

Page 17: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec5 0.15 msec 0.19 msec1020501001000

I # of atoms in universe ≈ 1080

Page 18: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec5 0.15 msec 0.19 msec10 0.01 sec20501001000

I # of atoms in universe ≈ 1080

Page 19: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec5 0.15 msec 0.19 msec10 0.01 sec 0.10 sec20501001000

I # of atoms in universe ≈ 1080

Page 20: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec5 0.15 msec 0.19 msec10 0.01 sec 0.10 sec20 0.04 sec501001000

I # of atoms in universe ≈ 1080

Page 21: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec5 0.15 msec 0.19 msec10 0.01 sec 0.10 sec20 0.04 sec 1.75 min501001000

I # of atoms in universe ≈ 1080

Page 22: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec5 0.15 msec 0.19 msec10 0.01 sec 0.10 sec20 0.04 sec 1.75 min50 0.25 sec1001000

I # of atoms in universe ≈ 1080

Page 23: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec5 0.15 msec 0.19 msec10 0.01 sec 0.10 sec20 0.04 sec 1.75 min50 0.25 sec 8.4 centuries1001000

I # of atoms in universe ≈ 1080

Page 24: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec5 0.15 msec 0.19 msec10 0.01 sec 0.10 sec20 0.04 sec 1.75 min50 0.25 sec 8.4 centuries100 1.00 sec1000

I # of atoms in universe ≈ 1080

Page 25: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec5 0.15 msec 0.19 msec10 0.01 sec 0.10 sec20 0.04 sec 1.75 min50 0.25 sec 8.4 centuries100 1.00 sec 9.4 × 1017 years1000

I # of atoms in universe ≈ 1080

Page 26: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec5 0.15 msec 0.19 msec10 0.01 sec 0.10 sec20 0.04 sec 1.75 min50 0.25 sec 8.4 centuries100 1.00 sec 9.4 × 1017 years1000 1.67 min

I # of atoms in universe ≈ 1080

Page 27: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 10.000 steps per second):

n n2 steps 2n steps2 0.02 msec 0.02 msec5 0.15 msec 0.19 msec10 0.01 sec 0.10 sec20 0.04 sec 1.75 min50 0.25 sec 8.4 centuries100 1.00 sec 9.4 × 1017 years1000 1.67 min 7.9 × 10288 years

I # of atoms in universe ≈ 1080

Page 28: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 1010 steps per second):

n n2 steps 2n steps2 0.00000002 msec 0.00000002 msec5 0.00000015 msec 0.00000019 msec10 0.00001 msec 0.0001 msec20 0.00004 msec 0.10 msec50 0.00025 msec 31.3 hours100 0.001 msec 9.4 × 1011 years1000 0.100 msec 7.9 × 10282 years

I # of atoms in universe ≈ 1080

Page 29: Computational Complexity - Lecture 1 · 2020-03-24 · What is Computational Complexity? I Thestudyofwhatyoucancomputewithlimitedresources I Resources,e.g.: time,memoryspace,randombits

Quadratic vs. Exponential

I Important difference between algorithms that run in time,say, n2 vs. algorithms that run in time, say, 2n

I Illustration (time needed for 1010 steps per second):

n n2 steps 2n steps2 0.00000002 msec 0.00000002 msec5 0.00000015 msec 0.00000019 msec10 0.00001 msec 0.0001 msec20 0.00004 msec 0.10 msec50 0.00025 msec 31.3 hours100 0.001 msec 9.4 × 1011 years1000 0.100 msec 7.9 × 10282 years

I # of atoms in universe ≈ 1080