0% found this document useful (0 votes)
85 views5 pages

Vasvi Khullar Mca - Iv (B) 06417704417

The document defines several key computational complexity terms: 1) Branch and bound mechanism is a systematic method for solving optimization problems that applies when greedy and dynamic programming fail. It involves systematically enumerating all possible solutions while pruning branches that cannot potentially contain an optimal solution. 2) Undecidable problems are problems where no algorithm exists to always determine the answer in finite time, such as determining if a context-free language is ambiguous. 3) Polynomial time verification refers to being able to efficiently "double check" or verify a proposed solution to a problem in polynomial time, even if finding the solution may be intractable. The document also differentiates complexity classes P, NP, NP-hard and NP

Uploaded by

vasvi khullar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views5 pages

Vasvi Khullar Mca - Iv (B) 06417704417

The document defines several key computational complexity terms: 1) Branch and bound mechanism is a systematic method for solving optimization problems that applies when greedy and dynamic programming fail. It involves systematically enumerating all possible solutions while pruning branches that cannot potentially contain an optimal solution. 2) Undecidable problems are problems where no algorithm exists to always determine the answer in finite time, such as determining if a context-free language is ambiguous. 3) Polynomial time verification refers to being able to efficiently "double check" or verify a proposed solution to a problem in polynomial time, even if finding the solution may be intractable. The document also differentiates complexity classes P, NP, NP-hard and NP

Uploaded by

vasvi khullar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

VASVI KHULLAR MCA – IV (B) 06417704417

DAA
ASSIGNMENT – 2
UNIT – 4
2014
1. Define the following terms :
a. Branch & bound mechanism
b. Undecidable problems
c. Polynomial time verification
Ans 1.
a) Branch & bound mechanism
Branch and bound is a systematic method for solving optimization problems. It is a rather
general optimization technique that applies where the greedy method and dynamic
programming fail.However, it is much slower. Indeed, it often leads to exponential time
complexities in the worst case.On the other hand, if applied carefully, it can lead to algorithms
that run reasonably fast on average.The general idea of B&B is a BFS-like search for the optimal
solution, but not all nodes get expanded (i.e., their children generated). Rather, a carefully
selected criterion determines which node to expand and when, and another criterion tells the
algorithm when an optimal solution has been found.

b) Undecidable Problems
A problem is undecidable if there is no Turing machine which will always halt in finite amount of
time to give answer as ‘yes’ or ‘no’. An undecidable problem has no algorithm to determine the
answer for a given input.
Examples
 Ambiguity of context-free languages: Given a context-free language, there is no Turing
machine which will always halt in finite amount of time and give answer whether
language is ambiguous or not.
 Equivalence of two context-free languages: Given two context-free languages, there is no
Turing machine which will always halt in finite amount of time and give answer whether
two context free languages are equal or not.
 Everything or completeness of CFG: Given a CFG and input alphabet, whether CFG will
generate all possible strings of input alphabet (∑*)is undecidable.
 Regularity of CFL, CSL, REC and REC: Given a CFL, CSL, REC or REC, determining whether
this language is regular is undecidable.

c) Polynomial time verification


For a recognition problem, if we are given a guess of a solution we want to verify if this solution
can help us answer the problem. If we can "double check" that the guess is a solution in
polynomial time, we say that we can verify the solution in polynomial time.

1
VASVI KHULLAR MCA – IV (B) 06417704417

Example, is there a Steiner tree of cost less than L?


If we guess a tree, we can verify polynomially if the tree is spanning the nodes we want, and if
its cost is less or equal to L.
Note that if the tree is of cost higher than L, then we can reject it as a solution, but we cannot
say "no" to the problem: there may exist some other tree with cost <= L.

2013

1. Differentiate between P, NP, NP hard and NPC problem.

Ans 1.
P NP NP HARD NPC
P is a complexity NP is a complexity Intuitively, these are NP-Complete is a
class that class that the problems that complexity class
represents the set represents the set are at least as hard which represents
of all decision of all decision as the NP-complete the set of all
problems that can problems for which problems. Note that problems X in NP
be solved in the instances NP-hard for which it is
polynomial time. where the answer problems do not possible to reduce
is “yes” have proofs have to be in NP, any other NP
that can be verified and they do not problem Y to X in
in polynomial time. have to be decision polynomial time.
problems.
The precise
definition here is
that a problem X is
NP-hard, if there is
an NP-complete
problem Y, such
that Y is reducible
to X in polynomial
time.

That is, given an This means that if But since any NP- Intuitively this
instance of the someone gives us complete problem means that we can
problem, the an instance of the can be reduced to solve Y quickly if
answer yes or no problem and a any other NP- we know how to
can be decided in certificate complete problem in solve X quickly.
polynomial time. (sometimes called a polynomial time, all Precisely, Y is
witness) to the NP-complete reducible to X, if
answer being yes, problems can be there is a
we can check that reduced to any NP- polynomial time
it is correct in hard problem in algorithm f to

2
VASVI KHULLAR MCA – IV (B) 06417704417

polynomial time. polynomial time. transform


Then, if there is a instances y of Y to
solution to one NP- instances x =
hard problem in f(y) of X in
polynomial time, polynomial time,
there is a solution to with the property
all NP problems in that the answer
polynomial time. to y is yes, if and
only if the answer
to f(y) is yes.

Example Example Example Example


Given a graph Integer The halting problem 3-SAT. This is the
connected G, can factorization is in is an NP-hard problem wherein
its vertices be NP. This is the problem. This is the we are given a
colored using two problem that given problem that given a conjunction
colors so that no integers n and m, isprogram P and (ANDs) of 3-clause
edge is there an integer f input I, will it halt? disjunctions (ORs),
monochromatic? with 1 < f < m, suchThis is a decision statements of the
that f divides n (f is
problem but it is not form
Algorithm: start a small factor of n)?
in NP. It is clear that
with an arbitrary any NP-complete (x_v11 OR x_v21
vertex, color it red This is a decision problem can be OR x_v31) AND
and all of its problem because reduced to this one. (x_v12 OR x_v22
neighbours blue the answers are yes As another example, OR x_v32) AND …
and continue. Stop or no. If someone any NP-complete AND (x_v1n OR
when you run out hands us an problem is NP-hard. x_v2n OR x_v3n)
of vertices or you instance of the
are forced to make problem (so they where each x_vij is
an edge have both hand us a boolean variable
of its endpoints be integers n and m) or the negation of
the same color. and an a variable from a
integer f with 1 < f finite predefined
< m, and claim list (x_1, x_2, ...
that f is a factor x_n).
of n (the
certificate), we can
It can be shown
check the answer in
that every NP
polynomial time by
problem can be
performing the
reduced to 3-SAT.
division n / f.
The proof of this is
technical and

3
VASVI KHULLAR MCA – IV (B) 06417704417

requires use of the


technical definition
of NP (based on
non-deterministic
Turing machines).
This is known as
Cook’s theorem.

2. Currently what are the various techniques used while dealing with NPC problem? Are
they optimal? Differentiate between decision problem and optimization problem.

Ans . 1) Narrowing the problem space

For instance, if we can't solve TSP on general graphs, let's try to just solve it for graphs obeying
a Euclidean distance metric.

2) Approximation Algorithms

Some NP-hard problems admit polynomial time approximation algorithms. Sometimes this give
only a constant factor approximation at best, such as MAX-CUT or Metric TSP, and sometimes it
yields a Polynomial Time Approximation Scheme, whereby one can trade additional running
time for a better approximation. (It's polynomial time in n with 1/epsilon in the exponent.) In
the case of Euclidean TSP, we have had such an algorithm since 2010.

3) Random Algorithms

This isn't really solely about solving NP-hard problems, as there are legitimate reasons to use
random algorithms to speed up solving problems in P as well. However, randomization does
offer an inroad to solving NP-hard problems more quickly. The idea is to remove the guarantee
that the algorithm work every time, but instead have it succeed at least 2/3 of the time,
depending on the luck of the draw. By re-running the algorithm until it succeeds, or increases
our confidence to the desired level, we can get an arbitrarily high probability for a correct
answer. This tactic lets us probably solve some NP-hard problems in robust control theory and
matrix theory in polynomial time. The main advantage of random algorithms is simplicity. These
algorithms are frequently very simple to describe and implement. Sometimes, they can be
transformed into complicated deterministic algorithms that maintain their approximation
guarantees. Frequently, they let us sample the problem space to create a solution on a smaller
input set, to try to extrapolate the solution to the larger space. They can also allow us to reduce
the dimensionality of a problem while maintaining some of its structure.

4
VASVI KHULLAR MCA – IV (B) 06417704417

4) Improved Exponential Time Algorithms

Just because a problem is NP-complete doesn't mean we have to brute force it. Even if we must
use an exponential time algorithm, not all such algorithms are the same, so we're always on the
look out for improvements in such algorithms. Consider the General Number Field Sieve for
factoring. (Yes, I know factoring hasn't been proved NP-hard--it's still a good example.) It takes
quite a bit of time to run, exponential in the size of the number to be factored, but it is leaps
and bounds ahead of, say, trial division. Quite large numbers can be factored on your home
computer in a day or two.

Sometimes exponential time algorithms actually run pretty quickly in practice. For instance, the
simplex algorithm for linear programs is still used despite its exponential worst case running
time, since it is so simple to implement and blazingly fast on most real world examples.

5) Parallelize!

Machines are becoming massively parallel, and each parallel part is becoming faster on its own.
Millions of simultaneous operations can be done in the GPU or FPU (or arrays of the same) on
modern computers. When computations for a problem can be done in parallel, it stops
mattering that exponentially many computations need to be done. In the real world, it's the
wall clock time that matters. Of course, not all problems admit easily parallelizable solutions...

6) Just brute force it!

Even serial processors are getting faster and faster. Even if you have to use a slow exponential
time algorithm AND perform all the computations in sequence, at the very least, you can get a
blindingly fast modern supercomputer to do it for you. Again, it's the wall clock time that
matters, not the number of steps in the computation.

Decision problem Optimization problem


In computability theory and computational In mathematics and computer science,
complexity theory, a decision problem is an optimization problem is the problem of
a problem that can be posed as a yes-no finding the best solution from all feasible
question of the input values. An example of solutions. Optimization problems can be
a decision problem is deciding whether a divided into two categories depending on
given natural number is prime. ... Adecision whether the variables are continuous or
problem which can be solved by an algorithm discrete.
is called decidable.

You might also like