how hard can a problem be ?

18
How Hard Can a Problem Be ? Ahmad Saeed Alexandria University

Upload: ahmed-saeed

Post on 28-Nov-2014

528 views

Category:

Education


1 download

DESCRIPTION

A Really Simple Introduction to Complexity and Computability

TRANSCRIPT

Page 1: How Hard Can a Problem Be ?

How Hard Can a Problem Be ?

Ahmad SaeedAlexandria University

Page 2: How Hard Can a Problem Be ?

Agenda

• Hard for whom ?• Easy Problems• Hard Problems• Unsolvable Problems !!

Page 3: How Hard Can a Problem Be ?

A Problem Solver (Turing Machine)

• Follow the instructions to solve the problem• Use a pencil, a rubber and a scrap paper• Use them to find the answer

• You now have a : Turing Machine

Page 4: How Hard Can a Problem Be ?

Turing Machines Formally 

• Physicallyo A Scratch Tape (Infinite)o A Moving head

• Mathematicallyo A set of possible symbols to write on the tapeo A set of "states"o A transition function between states

Page 5: How Hard Can a Problem Be ?

Turing Machine Example

• Determine whether the number of 1's in a sequence is o odd (print 0 at the end of the tape) o even (print 1 at the end of the tape) 

Page 6: How Hard Can a Problem Be ?

Church-Turing Thesis

Simply: If it's physically computable, it can be computed by a Turing Machine

Page 7: How Hard Can a Problem Be ?

"Easy" Problems (P)

• The class of problems that could be solved in Polynomial Time

• Exampleso Bubble Sort O(n2)o Matrix Multiplication O(n3)

• What about a problem of O(n100) ??

Page 8: How Hard Can a Problem Be ?

Nondeterminism 

Page 9: How Hard Can a Problem Be ?

Nondeterminism (Example)

• Travelling Salesman ProblemFind the path with the least cost to visit a set of cities

Page 10: How Hard Can a Problem Be ?

Nondeterminism (Example)

• What if we were really great guessers ??

Page 11: How Hard Can a Problem Be ?

"Hard" Problems (NP)

• Nondeterministic Polynomial• Problems that are solved in a polynomial time if

you are (or have access to) a perfect guesser• Examples

o 3 CNF(conjunctive normal form) SAT(satisfiability)

o Scheduling Problem

Page 12: How Hard Can a Problem Be ?

Can all problems be solved by a computer ??

Page 13: How Hard Can a Problem Be ?

Halting Problem

• Given a binary representation of a program P, determine whether it enters an infinite loop on input X or not.

Page 14: How Hard Can a Problem Be ?

Halting Problem Proof

• Assume that we have Halt(P,x) which is a program that o returns 0 if program P terminates on input xo returns 1 it doesn't program doesn't halt

• Let M(x) be a program thato doesn't terminate (loops forever) if Halt(x,x)

returns 0o terminates if Halt(x,x) returns 1

• What's the results if M(M) ??

Page 15: How Hard Can a Problem Be ?

What have we been talking about ??

• Different models of computation boil down to Turing Machine

• N = NP ??? • Computers can't do everything but can we ??

Page 16: How Hard Can a Problem Be ?

References

• Computational Complexity: A Modern ApproachTextbook by Sanjeev Arora and Boaz Barak, Cambridge University Press.

• Lecture notes for cs1510 of Prof Kirk Pruhs of the Dept of Computer Science, University of Pittsburg

• Lecture notes for CSc2010 of Prof Jaman L. Bhola of the Dept of Computer Science, Georgia State University

• Wikipedia, 2011

Page 17: How Hard Can a Problem Be ?

Any Questions ??

(Open Discussion)

Page 18: How Hard Can a Problem Be ?

Thank you for hanging around!!

Ahmad Saeedwww.ahmad-saeed.co.cc

[email protected]