Polynomial Problems
• Most algorithms you have studied are polynomial
– informally, a problem is polynomial-time solvable if
there exists an algorithm to solve it in time O(nk) for
some constant k
– we rely on this intuitive understanding; we will skip
section 34.1 that defines terminology formally using
decision problems and formal language theory
• Not every problem is polynomial
– the “halting problem” you studied in theory of
computation is insolvable no matter how much time
you have
– Other complexity classes are nonpolynomial or
superpolynomial
The Hamiltonian Cycle Problem
• A graph is hamiltonian if there exists a simple
cycle that contains every vertex
– graph (a) is
hamiltonian
– bipartite graph (b)
with an odd number
of vertices is never
hamiltonian
• Intuitively this is not a polynomial time problem
– let m be the number of vertices, we must check m!
permutations to find a cycle
– But (m!) = (2n) if n = |G|
Verification Algorithms
• Given a hamiltonian cycle in a graph, it is easily
verified that the graph is hamiltonian
– make sure the cycle is a permutation of all vertices
– make sure the cycle is made up of edges that are
actually in the graph; these steps take O(n2) time
• Intuitively, an algorithm A verifies a language L if
for any string x {0,1}*, there is a certificate y
that we can use to prove that x L
• For our hamiltonian problem
– a hamiltonian cycle verifies the graph is hamiltonian
– for a non-hamiltonian graph, no list of vertices can
fool the verification algorithm
The Class NP
• The complexity class NP is the class of languages
that can be verified by a polynomial-time algorithm
• Clearly P NP, but does P = NP?
– This has never been proved or disproved, but almost
everyone believes it is not true
– It is also not known if NP is closed under complement; in
other words, does co-NP = NP?
– P is closed under complement so P NP co-NP
– but it is not known if P = NP co-NP
The Possibilities
• (a) appears to be
unlikely
• (b) is possible if
NP is closed under
complement
• (c) NP is not closed under complement, but
P = NP co-NP
• (d) NP co-NP and P NP co-NP
• Most researchers believe that (d) is true, but it
remains unproven
© Copyright 2026 Paperzz