Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Joe Meehean.  Log: binary search in sorted array  Linear: traverse a tree  Log-Linear: insert into a heap  Quadratic (N 2 ): your sort from P1 

Similar presentations


Presentation on theme: "1 Joe Meehean.  Log: binary search in sorted array  Linear: traverse a tree  Log-Linear: insert into a heap  Quadratic (N 2 ): your sort from P1 "— Presentation transcript:

1 1 Joe Meehean

2  Log: binary search in sorted array  Linear: traverse a tree  Log-Linear: insert into a heap  Quadratic (N 2 ): your sort from P1  Exponential (N N ): brute force map coloring 2

3  Upper bound is N k for N inputs e.g., O(logN), O(N), O(NlogN), O(N 2 ), …  Problems in class P have known polynomial time solutions 3

4  Slipping into computational theory  Deterministic programs like the ones we write in C++ must search or construct the correct answer if there are many possible solutions must check them all OR carefully construct the answer piece-wise 4

5  Non-deterministic programs currently exist only in theory program guided by all knowing oracle oracle can create a possible solution to the problem for free solution is often the correct one  if a solution exists 5

6  Think about reducing problem to yes/no  Given a potential solution to problem is it possible to determine whether it is correct in polynomial time  Problems like this are in the NP class if in NP, but not P then there is no known polynomial time solution for these problems but we can check answers in polynomial time 6

7  e.g., graph coloring given a potential coloring of vertices for each vertex compare its colors to its neighbors O(E + V) = polynomial time only need one correct k coloring to prove graph can be colored with k colors 7

8 8 NP P

9  Hardest problems in NP  Any problem in NP can be polynomially reduced to all NP complete problems NP problem A can be translated into NP complete problem B in polynomial time e.g. calculator  numbers entered in decimal  converted to binary and solved in binary  converted back to decimal  Min color graph coloring is NP complete 9

10 10 NP P NP Complete maybe

11  If we can solve an NP complete problem A in polynomial time we can use it as a method (sub routine) to solve other NP problem B just translate the B into A in polynomial time solve A translate solution back into B polynomial time + polynomial time = polynomial time 11

12  If we can solve an NP complete problem A in polynomial time we can solve ALL NP problems in polynomial time P = NP 12

13 13 NP P NP Complete

14  P = NP?  No one has solved an NP complete problem in polynomial time  …Yet 14

15  Problems that are impossible to solve using a Turing machine-based computer impossible to solve with modern computers  E.g., halting problem does a program have an infinite loop? proof is simple to explain proof is hard to understand  involves recursion and impossible outcomes 15

16 16


Download ppt "1 Joe Meehean.  Log: binary search in sorted array  Linear: traverse a tree  Log-Linear: insert into a heap  Quadratic (N 2 ): your sort from P1 "

Similar presentations


Ads by Google