Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Imp questions

1. State the Job – Sequencing with deadlines problem and write algorithm . Find an optimal
sequence to the n=5 Jobs where profits (P1,P2,P3,P4,P5) = (20,15,10,5,1) and deadlines
(d1,d2,d3,d4,d5) =( 2,2,1,3,3).

2. Explain Cook’s theorem.Differentiate between NP-complete and NP-Hard.

3. Consider 4 elements al < a2 < a3 < a4 (count, float, if, while) with q(0) =1/5, q(1) =1/10,
q(2) =1/5, q(3) =1/20,q(4) =1/20 p(1) =1/20, p(2) =1/5, p(3) = 1/10,p(4) =1/20. Construct
the table of value of W(i, j), R(i. j) and C(i, j) computed by the algorithm to compute the
roots of optimal sub trees and construct OBST.

4. Draw the portion of state space tree generated by LCBB for the 0/1 Knapsack instance: n =
5, (p1,p2,…,p5) = (10,15,6,8,4), (w1,w2,..,w5) = (4,6,3,4,2) and M=12. Find an optimal
solution using fixed – tuple sized approach.

5. Construct an Optimal travelling sales person tour for given 4*4 matrix using Dynamic
Programming.
0 10 9 3
5 0 6 2
9 6 0 7
7 3 5 0

6. What is a Minimum Cost Spanning tree? Write an algorithm for Kruskal’s MST and
construct tree for given example.

7. Describe the Dynamic 0/1 Knapsack Problem and write pseudo code. Find an optimal
solution for the dynamic programming 0/1 knapsack instance using set representation for
n=5, M=15, profits are (p1, p2,p3,p4,p5 ) = ( 4, 2, 1, 2, 10), weights are
(w1,w2,w3,w4,w5)=( 12, 2, 1, 1, 4).

8. Draw the portion of state space tree generated by FIFO Branch and Bound for the 0/1
Knapsack
instance: n = 5, (p1,p2,…,p5) = (10,15,6,8,4), (w1,w2,..,w5) = (4,6,3,4,2) and M=12. Find an
optimal solution using fixed – tuple sized approach.

9. Discuss about cook’s theorem. What is the satisfiability problem? Explain the classes of
P and NP. Differentiate between NP-complete and NP-Hard.
10. Design a three stage System with device types D1,D2, and D3.the costs are 30,15,and 20
Respectively. The Cost of the system is105. And The reliability of each device types is
0.9,0.8, and 0.5Respectively.

11. Explain Travelling sales person problem LCBB procedure with the following instance and
draw the portion of the state space tree and find an optimal tour. Cost matrix is
INF 20 30 10 11

15 INF 16 4 2

3 5 INF 2 4

19 6 8 INF 3

16 4 7 16 INF

12. What is a Minimum Cost Spanning tree? Write an algorithm for Prims MST and construct
tree for given example.

Short questions

1. Give the statement of Reliability design problem.


2. Define P, NP, NP-Complete and NP-Hard.
3. What is purging or dominance rule. How it is applicable.
4. What is branch and bound algorithm? How it is different from backtracking?
5. Compare LC and FIFO brand- and-bound.
6. What is meant by non-deterministic algorithm?
7. Define Bellman’s Optimality Principle.
8. Write Control Abstraction for Greedy Strategy?
9. Define i) Principles of optimality ii) Feasible solution iii) Optimal solution.
10. Define Branch and Bound Techniques with examples.
11. What is NP-hard problem?
12. Distinguish between Dynamic Programming and Greedy method.

This makes most sense to take about with respect to optimization problems. In an
optimization problem, you have constraints that any solution produced by the algorithm
must satisfy (think of these as the “rules” of the problem). We call solutions that satisfy
all the constraints of the optimization problem feasible, and the feasible solution that
has maximum/minimum (depending on the objective/goal) value an optimal solution.
So in short, every optimal solution of an optimization problem is a feasible solution, but
not every feasible solution (most times) is an optimal solution.

The principle of optimality applies: if k is the node on the shortest path from i to j then the
part of the path from i to k and the part from k to j must also be optimal, that is shorter.

Branch and bound is an algorithm design paradigm which is generally used for
solving combinatorial optimization problems

Branch and Bound: General method, applications - Travelling sales person problem, 0/1
knapsack problem - LC Branch and Bound solution, FIFO Branch and Bound solution

Feature Greedy method Dynamic programming

In Dynamic Programming we
In a greedy Algorithm, we make decision at each step
make whatever choice seems considering current problem
best at the moment in the and solution to previously
hope that it will lead to global solved sub problem to
Feasibility optimal solution. calculate optimal solution .

It is guaranteed that Dynamic


In Greedy Method, Programming will generate an
sometimes there is no such optimal solution as it generally
guarantee of getting Optimal considers all possible cases
Optimality Solution. and then choose the best.

A Dynamic programming is an
A greedy method follows the algorithmic technique which is
problem solving heuristic of usually based on a recurrent
making the locally optimal formula that uses some
Recursion choice at each stage. previously calculated states.

It is more efficient in terms of It requires dp table for


memory as it never look back memoization and it increases
Memoization or revise previous choices it’s memory complexity.

Time Greedy methods are Dynamic Programming is


Feature Greedy method Dynamic programming

generally faster. For


example, Dijkstra’s shortest generally slower. For
path algorithm takes example, Bellman Ford
complexity O(ELogV + VLogV) time. algorithm takes O(VE) time.

The greedy method


computes its solution by Dynamic programming
making its choices in a serial computes its solution bottom
forward fashion, never up or top down by
looking back or revising synthesizing them from
Fashion previous choices. smaller optimal sub solutions.

Fractional knapsack . 
Example   0/1 knapsack problem 

arameter Backtracking Branch and Bound

Backtracking is used to find


all possible solutions
available to a problem. Branch-and-Bound is used to
When it realises that it has solve optimisation problems.
made a bad choice, it When it realises that it already
undoes the last choice by has a better optimal solution that
backing it up. It searches the the pre-solution leads to, it
state space tree until it has abandons that pre-solution. It
found a solution for the completely searches the state
Approach problem.  space tree to get optimal solution.

Backtracking traverses the


state space tree
by DFS(Depth First Branch-and-Bound traverse the
Traversal Search) manner. tree in any manner, DFS or BFS.

Backtracking involves Branch-and-Bound involves a


Function feasibility function. bounding function.
Backtracking is used for Branch-and-Bound is used for
Problems solving Decision Problem. solving Optimisation Problem.

In Branch-and-Bound as the
optimum solution may be present
In backtracking, the state any where in the state space
space tree is searched until tree, so the tree need to be
Searching the solution is obtained. searched completely.

Backtracking is more Branch-and-Bound is less


Efficiency efficient. efficient.

Useful in solving Knapsack
Useful in solving N-Queen Problem, Travelling Salesman
Applications Problem, Sum of subset. Problem.

Dominance Rule: If Si+1continas two ordered pairs (Pj,Wj), (Pk,Wk) such that PjWk then
the ordered pair (Pj,Wj) is discarded.

The problem is to design a system that is composed of several devices connected in series.
Let ri be the reliability of device Di (that is ri is the probability that device i will function
properly) then the reliability of the entire system is ∏ ri. Even if the individual devices are
very reliable (the ri’s are very close to one), the reliability of the system may not be very
good.

Algorithm GreedyMethod (a, n)

// a is an array of n inputs

Solution: =Ø;

for i: =0 to n do

s: = select (a);

if (feasible (Solution, s)) then

{
Solution: = union (Solution, s);

else reject (); // if solution is not feasible reject it.

return solution;

You might also like