Download presentation

Presentation is loading. Please wait.

Published byStanley Longyear Modified over 2 years ago

1
Lecture # 38 Algorithms & Problem Solving: How Hard Can it Get?

2
Computability Tractable problems (P): Can be solved by a a computer is some deterministic (reasonable) polynomial time –What is a ”reasonable” running time? Intractable problems (NP): 1. Guess the solution 2. Answer must be verifiable in polynomial time

3
Goal: transfer all n disks from peg 1 to peg 3 Rules: –move one disk at a time –never place a larger disk on top of a smaller one Example: Towers of Hanoi Simonas Šaltenis, Aalborg University, simas@cs.auc.dk 1 2 3

4
DEMO (http://www.mathcs.org/java/programs/Hanoi/index.html) Towers of Hanoi

5
How Long? 64 disks Move 1 disk per second 585 billion years Is that tractable/reasonable? Towers of Hanoi

6
Monkey Puzzle Nine square cards with imprinted “monkey halves” Goal: arrange the cards in 3x3 square with matching halves... Simonas Šaltenis, Aalborg University, simas@cs.auc.dk

7
More Monkeying around How long to match the monkey cards for a 3x3 square? Trying all possibilities, if you could try 1/per second, you could do it in about 4 days How long to match the monkey cards for a 5x5 square? Trying all possibilities, if you could try 1,000,000/per second, it would take 490 billion years to verify whether a solution exists Simonas Šaltenis, Aalborg University, simas@cs.auc.dk

8
Monkey Business cont. Can we improve the Brute Force algorithm? A smart algorithm would still take thousands of years, worst case Easier way to find solutions? MAYBE! But nobody has found them, yet! (room for smart students...) Simonas Šaltenis, Aalborg University, simas@cs.auc.dk

9
Reasonable vs. Unreasonable function/ n 102050100300 n2n2 1/10,000 second 1/2,500 second 1/400 second 1/100 second 9/100 second n5n5 1/10 second 3.2 seconds 5.2 minutes 2.8 hours 28.1 days 2n2n 1/1000 second 1 second 35.7 years 400 trillion centuries a 75 digit- number of centuries n 2.8 hours 3.3 trillion years a 70 digit- number of centuries a 185 digit- number of centuries a 728 digit- number of centuries Exponential Polynomial Simonas Šaltenis, Aalborg University, simas@cs.auc.dk How Hard can a Problem Be?:

10
Reasonable vs. Unreasonable ”Good”, reasonable algorithms –algorithms bound by a polynomial function n k –Tractable problems ”Bad”, unreasonable algorithms –algorithms whose running time is above n k –Intractable problems intractable problems tractable problems Problems with no reasonable algorithms/solutions Problems with reasonable (polynomial-time) algorithms/solutions Simonas Šaltenis, Aalborg University, simas@cs.auc.dk

11
So What?! Computers get faster every year –But that is an insignificant speed-up (a constant) compared to exponential running time Maybe the Monkey puzzle is just one specific problem, we could simply ignore –the monkey puzzle falls into a category of problems called NPC (NP complete) problems (~1000 problems) –all have unreasonable solutions –not known to admit reasonable ones… Simonas Šaltenis, Aalborg University, simas@cs.auc.dk

Similar presentations

OK

1 P and NP. 2 Introduction The Traveling Salesperson problem and thousands of other problems are equally hard in the sense that if we had an efficient.

1 P and NP. 2 Introduction The Traveling Salesperson problem and thousands of other problems are equally hard in the sense that if we had an efficient.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on social media in india Ppt on global warming with pictures Ppt on forest management in india Ppt on power system Ppt on l&t finance india Ppt on trade fairs Ppt on collection of secondary data Ppt on union parliament of india Ppt on index numbers formula Ppt on electricity generation by walking