Computational Complexity Theory and Polynomial Time

Topics: Computational complexity theory, Halting problem, Algorithm Pages: 5 (1105 words) Published: December 16, 2012
Intractable Problems Intractable Problems The Classes P and NP Mohamed M. El Wakil Mohamed M. El Wakil


1. 2. 3. 4. 5. 5 What is a problem? Decidable or not? Decidable or not? The P class The NP Class The NP Complete class The NP‐Complete class


What is a problem? What is a problem?
• A problem is a question to be answered.
– What is the value of X/Y?

• A problem usually has parameters. p y p
– X, and Y

• A decision problem is a version of the A decision problem, is a version of the  problem with only two possible answers: Yes  or No! or No! – Given two numbers X, and Y, does Y evenly divide  X?

• An instance: a specific problem instance
– Does 3 evenly divide 6?

Decidable or not? Decidable or not?
• A decidable problem, is a problem that could  be solved using a computer. • A An undecidable problem, is a problem that  d id bl bl i bl th t can never be solved using a computer, neither  now or in the future. • Only decidable problems! 4

• We need to classify problems in terms of their  p y computability. • Th Three classes: l – P class – NP Class – NP‐Complete class NP‐Complete class


P class, wrt P class wrt Computers
• Problems with at least one algorithm that  solves the problem in polynomial time wrt to  l h bl i l i l i the input size. • Polynomial time Polynomial time  – The number of steps needed relates polynomially  to the size of the input.  to the size of the input – O(n2), O(n9), O(nc), where c is a constant. – but NOT O(n!) O(2n) when n is the size of the but NOT O(n!), O(2 ), when n is the size of the  input. 6

P class, wrt Turing Machines P class wrt Turing Machines • Problems solvable in polynomial time using a  Deterministic  Turing Machine  (DTM) belong to  D t i i ti T i M hi (DTM) b l t the class P. • Polynomial time  – The number of moves needed relates polynomially to  the size of the input.  • n2, 17n3, 9n4, but NOT 2n

– A Turing machine with a tape, head, transition  function, and a set of states. 7

P Problem (MWST) P Problem (MWST)
• Minimum Weight Spanning Tree 
– Given a weighted graph G, find the minimum  g g p , weight spanning tree.  – In other words, convert the given graph into a  tree, that includes all the nodes of the original  tree that includes all the nodes of the original graph, and minimizes the summation of weights of  the edges in the resulting tree. the edges in the resulting tree


MWST Example Problem Instance


Kruskal s Kruskal's algorithm
• The MWST problem belongs to the P class of  h S bl b l h l f problems, since there is an algorithm that solves   it in polynomial time.  it i l i l ti • Kruskal's algorithm O(n2) – Create a forest F (a set of trees), where each vertex in  the graph is a separate tree  – Create a set S containing all the edges in the graph  – While S is nonempty  • Remove an edge with minimum weight from S  • If that edge connects two different trees, then add it to the  forest, combining two trees into a single tree  forest, combining two trees into a single tree • Otherwise discard that edge  10

MWST Example Possible Solution


NP class, wrt Turing Machines NP class wrt Turing Machines • Problems solvable in polynomial time using a  g ( ) Non Deterministic Turing Machine  (NDTM)  belong to the class NP. – NDTM
• A DTM, with two stages of processing: guessing, and  h f d checking. 


Non‐Deterministic Turing Machine Non Deterministic Turing Machine • G Guessing: i
– Guess a solution, and then write it down to the tape. – Checking: • Evaluate the guess to decide whether it solves the problem  or not.

• The number of guessed solutions can be either The number of guessed solutions, can be either  polynomial or exponential. • If th If the number of guessed solutions is polynomial,  b f d l ti i l...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Complexity Theory Essay
  • Time and Space Complexity Essay
  • Polynomials Essay
  • Essay about Environmental Complexity
  • Essay on A Theory of the Allocation of Time
  • Phantom Time Theory Essay
  • Essay about Its time
  • Theories Essay

Become a StudyMode Member

Sign Up - It's Free