Download presentation
Presentation is loading. Please wait.
Published byRegina Terry Modified over 9 years ago
1
Optimization/Decision Problems Optimization Problems – An optimization problem is one which asks, “What is the optimal solution to problem X?” – Examples: Minimum Spanning Tree Decision Problems – An decision problem is one with yes/no answer – Examples: Does a graph G have a MST of weight W?
2
Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What reasonable time? Standard working definition: polynomial time On an input of size n the worst-case running time is O(n k ) for some constant k O(n 2 ), O(n 3 ), O(1), O(n lg n), O(2 n ), O(n n ), O(n!) Polynomial time: O(n 2 ), O(n 3 ), O(1), O(n lg n) Not in polynomial time: O(2 n ), O(n n ), O(n!)
3
Determinism vs. Nondeterminism Nondeterministic algorithms produce an answer by a series of “correct guesses” Deterministic algorithms (like those that a computer executes) make decisions based on information.
4
Complexity Class P Deterministic in nature Solved by conventional computers in polynomial time – O(1)Constant – O(log n)Sub-linear – O(n)Linear – O(n log n)Nearly Linear – O(n 2 )Quadratic Polynomial upper and lower bounds
5
Complexity Class NP Two Properties: non-deterministic method to generate possible solutions, deterministic method to verify in polynomial time that the solution is correct.
6
Relation of P and NP P is a subset of NP “P = NP”? Language L is in NP, complement of L is in co- NP co-NP ≠ NP P ≠ co-NP
7
TSP For each two cities, an integer cost is given to travel from one of the two cities to the other. The salesperson wants to make a minimum cost circuit visiting each city exactly once. 3 1 1 1 2 2 3 4 1 2 2 1 2 2 4 4 1 5 1 i = 23 2
8
NP-Complete “NP-Complete” comes from: – Nondeterministic Polynomial – Complete - “Solve one, Solve them all” There are more NP-Complete problems than provably intractable problems.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.