DAAImp Questions
DAAImp Questions
DAAImp 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).
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
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
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 .
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.
Fractional knapsack .
Example 0/1 knapsack 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.
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.
// a is an array of n inputs
Solution: =Ø;
for i: =0 to n do
s: = select (a);
{
Solution: = union (Solution, s);
return solution;