Download presentation
Presentation is loading. Please wait.
1
Complexity ©D.Moshkovitz 1 Introduction
2
Complexity ©D.Moshkovitz 2 Introduction Objectives: –To introduce some of the basic concepts of complexity theory. Overview: –Tea parties and computations –Growth rate and reasonability –Reducibility – … And more…
3
Complexity ©D.Moshkovitz 3 The Crazy Tea Party Problem To seat all guests at a round table, so people who sit in adjacent seats like each other. JohnMaryBobJaneAlice John Mary Bob Jane Alice
4
Complexity ©D.Moshkovitz 4 Solution for the Example Alice Bob Jane John Problem To seat all guests at a round table, so people who sit an adjacent seats like each other. Mary
5
Complexity ©D.Moshkovitz 5 Naive Algorithm For each ordering of the guests around the table –Verify each guest likes the guest sitting in the next seat.
6
Complexity ©D.Moshkovitz 6 How Much Time Should This Take? (worse case) guests steps n (n- 1)! 5 24 15 87178291200 100 9 · 10 155 say our computer is capable of 10 10 instructions per second, this will still take 3 · 10 138 years!
7
Complexity ©D.Moshkovitz 7 Tours Problem Plan a trip that visits every site exactly once.
8
Complexity ©D.Moshkovitz 8 Solution for the Example Problem Plan a trip that visits every site exactly once.
9
Complexity ©D.Moshkovitz 9 Naive Algorithm (Backtracking) For each site –Try out all reachable sites, which have not been visited yet –Backtrack and retry –Repeat the process until stuck
10
Complexity ©D.Moshkovitz 10 How Much Time Should This Take? sites steps n n! 5 120 15 1307674368000 100 9 · 10 157 If our computer can carry out 10,000 instructions per second, than it will take us 4 years!
11
Complexity ©D.Moshkovitz 11 Is a Problem Tractable? YES! And here’s the efficient algorithm for it NO! and I can prove it and what if neither is the case?
12
Complexity ©D.Moshkovitz 12 Food for Thought… Can you design an efficient algorithm for the tour problem if the sites’ map contains no cycles?
13
Complexity ©D.Moshkovitz 13 Growth Rate: Sketch 10n n2n2 2n2n n! =2 O(n lg n) input length time
14
Complexity ©D.Moshkovitz 14 The World According to Complexity reasonableunreasonable polynomial n O(1) exponential 2 n O(1)
15
Complexity ©D.Moshkovitz 15 Could One be Fundamentally Harder than the Other? Tour Seating ?
16
Complexity ©D.Moshkovitz 16 Relations Between Problems Assuming an efficient procedure for problem A, there is an efficient procedure for problem B B cannot be radically harder than A
17
Complexity ©D.Moshkovitz 17 Reductions B pp A B cannot be radically harder than A In other words: A is at least as hard as B
18
Complexity ©D.Moshkovitz 18 Which One is Harder? Tour Seating ?
19
Complexity ©D.Moshkovitz 19 Reduce Tour to Seating First Observation: The problems aren’t so different site guest “directly reachable from…”“liked by…”
20
Complexity ©D.Moshkovitz 20 Reduce Tour to Seating Second Observation: Completing the circle Let’s invite to our party a very popular guest, i.e one who can sit next to everyone else.
21
Complexity ©D.Moshkovitz 21 Reduce Tour to Seating If there is a tour, there is also a way to seat all the imagined guests around the table.... popular guest
22
Complexity ©D.Moshkovitz 22 Reduce Tour to Seating If there is a seating, we can easily find a tour path (no tour, no seating).... popular guest...
23
Complexity ©D.Moshkovitz 23 Bottom Line The seating problem is at least as hard as the tour problem
24
Complexity ©D.Moshkovitz 24 Discussion Although we couldn’t come up with an efficient algorithm for the problems Nor to prove they don’t have one, We managed to show a very powerful claim regarding the relation between their hardness
25
Complexity ©D.Moshkovitz 25 Discussion Interestingly, we can also reduce the seating problem to the tour problem. Moreover, there is a whole class of problems, which can be pairwise efficiently reduced to each other.
26
Complexity ©D.Moshkovitz 26 Food for Thought… Can you reduce the seating problem to the tour problem?
27
Complexity ©D.Moshkovitz 27 NPC Contains thousands of distinct problem exponential algorithms efficient algorithms ? each reducible to all others
28
Complexity ©D.Moshkovitz 28 How Can Studying Complexity Make You a Millionaire? P vs NP is the most fundamental open question of computer science. Resolving it would get you great honor … as well as substantial fortune… www.claymath.org/prizeproblems/pvsnp.htm www.claymath.org/prizeproblems/pvsnp.htm Philosophical: if P=NP –Human ingenuity unnecessary –No need for mathematicians!! Is nature nondeterministic?
29
Complexity ©D.Moshkovitz 29 What More? Let’s review some more questions to be discussed in this course.
30
Complexity ©D.Moshkovitz 30 Generalized Tour Problem Add prices to the roads of the tour problem Ask for the least costly tour $8 $10 $13 $12 $19 $3 $17 $13
31
Complexity ©D.Moshkovitz 31 Approximation How about approximating the optimal tour? I.e – finding a tour which costs, say, no more than twice as much as the least costly. $8 $10 $13 $12 $19 $3 $17 $13
32
Complexity ©D.Moshkovitz 32 Is Running Time the Only Precious Resource? How about memory (space)? Are there other resources?
33
Complexity ©D.Moshkovitz 33 Games Each player picks a word, which begins with the letter that ended the previous word. Apple Egg Girl Lord DogGuy YardDeer
34
Complexity ©D.Moshkovitz 34 Dictionary Apple EggGirl Ear Lord Dog Red
35
Complexity ©D.Moshkovitz 35 Game Tree EggGirlDogAppleEarLordRed GirlEggEarDog LordGirlRed Lord Dog Girl Lord DogGirl Lord Girl RedLordDogLordDogGirl Apple Egg Girl Ear Lord Dog Red
36
Complexity ©D.Moshkovitz 36 Winning Games How can we find a winning strategy for this game? How much space would it take to compute it using game trees?
37
Complexity ©D.Moshkovitz 37 Summary We got to know two problems: –The seating problem (HAMILTONIAN-CYCLE) –The tour problem (HAMILTONIAN-PATH) Although we could say very little about them, we managed to show their computational hardness are related. Moreover, we claimed they are part of a large class of problems, called NPC.
38
Complexity ©D.Moshkovitz 38 Summary We also mentioned some of the topics we will discuss later in the course: –Approximation –Space-bounded computations
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.