Cs6402-Design and Analysis of Algorithms Unit-I
Cs6402-Design and Analysis of Algorithms Unit-I
PROBLEM
ALGORITHM
II Year / IV Sem 1
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
Space Complexity indicates how much extra memory the algorithm needs. Basicallyit has three
components. They are instruction space, data space and environmentspace.
To choose best algorithm, we need to check efficiency of each algorithm the efficiency can be
measured by computing time complexity of each algorithm. Asymptotic notation is shorthand way to
represent the time complexity
The various notations are Big “Oh”, Big Omega, and Theta.
16. Define the asymptotic notation “Big oh” (0) (May 2008)(April/May 2012&2013)
Let, f(n) and g(n) be two non-negative functions. Let, n0 and constant c are two integers such that no
denotes some value of in put similarly c is constant such that c > 0. We can write
1 for n 1
T (n)
T(n - 1) + 1 otherwise
(ii) Binary search
1 for n 1
T (n)
T(n/2) + 1 otherwise
22. What are the Best, Worst and Average Case complexity of Linear Search?
Best Case – O(1)
Average Case – O(N)
Worst Case – O(N)
II Year / IV Sem 4
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
24. Give the general plan for analyzing non recursive algorithm.
Decide a parameter indicating an Input’s Size.
Identify the algorithms Basic Operation
Check whether the number of times the basic operation is executed only on thesize of an
input. If it also depends on some additional property, the worst case,average case, and if
necessary, best case efficiencies have to be investigatedseparately.
Using standard formulas and rules of sum manipulation either find a closedformula for the
count or, at the very least, establish its order of growth.
26. What are all the methods available for solving recurrence relations?
Forward Substitution
Backward Substitution
Smoothness Rule
Master Theorem
II Year / IV Sem 5
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
32. Give the General Plan for the Empirical Analysis of Algorithm Time Efficiency?
1. Understand the experiment’s purpose.
2. Decide on the efficiency metric M to be measured and the measurement unit
(an operation count vs. a time unit).
3. Decide on characteristics of the input sample (its range, size, and so on).
4. Prepare a program implementing the algorithm (or algorithms) for the experimentation.
5. Generate a sample of inputs.
6. Run the algorithm (or algorithms) on the sample’s inputs and record the data
observed.
7. Analyze the data obtained.
33. Write an algorithm to check whether the given string is Palindrome or not. (NOV/DEC
2008)
1. Get the number from user.
2. Reverse it.
3. Compare it with the number entered by the user.
4. If both are same then print palindrome number
5. Else print not a palindrome number.
34. Write an algorithm to find the number of binary digits in the binary representation of a
positive decimal integer. (MAY 2015)
ALGORITHM Binary(n)
//Input: A positive decimal integer n
//Output: The number of binary digits in n’s binary representation
count<- 1
while n>1 do
count<- count+1
n<- [n/2]
return count
II Year / IV Sem 6
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
36. Give the Euclid’s algorithm for computing gcd(m, n) (MAY-JUN 2016)
ALGORITHM Euclid_gcd(m, n)
//Computes gcd(m, n) by Euclid’s algorithm
//Input: Two nonnegative, not-both-zero integers m and n
//Output: Greatest common divisor of m and n
while n ≠ 0 do
r ←m mod n
m←n
n←r
return m
Example: gcd(60, 24) = gcd(24, 12) = gcd(12, 0) = 12.
37. Compare the order of growth n(n-1)/2 and n2. (MAY-JUN 2016)
2
n n(n-1)/2 n
Polynomial Quadratic Quadratic
1 0 1
2 1 4
4 6 16
8 28 64
2
10 45 10
2 4
10 4950 10
Complexity Low High
Growth Low high
2
n(n-1)/2 is lesser than the half of n
PART B
1. Define the asymptotic notations used for best case average case and worst case analysis?
(APRIL/MAY2009) (APRIL/MAY 2008) (U)
2. How do you evaluate the performance of the algorithms? (E)
3. Explain the general framework for analyzing the efficiency of algorithm. (R)
4. Explain properties of BIG (oh) Notation.(8) (MAY 2016) (U)
5. What is meant by recurrence? Give one example to solve recurrence equations.
(APRIL/MAY012) (U)
6.(i) Distinguish between Big Oh, Theta and Omega natation. (NOV/DEC 2012) (R)
(ii) Analyze the best, worst and average case analysis for linear search. (An)
7.Find complexity of algorithm C (n) of the algorithm for the best, worst, average case,(evaluate
average case complexity of n=3 n mean number of inputs.(Ap)
8. (i) Define Asymptotic notations. Distinguish between Asymptotic notation and conditional
II Year / IV Sem 7
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
15. (i) Find the time complexity and space complexity of the following problems. Factorial using
Recursion AND Compute nth Fibonacci Number using Iterative statements.(Ap)
(ii) Solve the following recurrence relations:(NOV/DEC 2012) (Ap)
1).
16. Solve the following inequalities are correct (MAY/JUNE 2013) (Ap)
(i)
(ii) n!=O( )
(iii)
(iv)
17. If you have to solve the searching problem for a list of n numbers, how can you take
advantage of the fact that the list is known to be sorted? Give separate answer for
(i) list represented as arrays
(ii) lists represented as linked lists
Compare the time complexities involved in the analysis of both the algorithms.(MAY 2015) (C)
18. (i) Derive the worst case analysis of merge sort using suitable illustrations.(8) (C )
(ii) Derive a loose bound on the following equation (8) (C )
F(x)=35x8 -22x7 +14x5 – 2x4-4x2+x-15
19. Give an algorithm to check whether all the Elements in a given array of n elements
are distinct. Find the worst case complexity of the same.(8) (MAY / JUNE 2016) (Ap)
20. Give the recursive algorithm which finds the number of binary digits in the binary of a
II Year / IV Sem 8
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
positive decimal integer. Find the recurrence relation and complexity. (MAY / JUNE 2016) Ap)
COURSE OUTCOMES:
Basic ability to analyze algorithms and to determine algorithm correctness and time efficiency
class.
UNIT II
BRUTEFORCE AND DIVIDE-AND-CONQUER
PART A
SYLLABUS: Brute Force - Closest-Pair and Convex-Hull Problems-Exhaustive Search -
Traveling Salesman Problem - Knapsack Problem - Assignment problem. Divide and conquer
methodology – Merge sort – Quick sort – Binary search – Multiplication of Large Integers –
Strassen’s Matrix Multiplication-Closest-Pair and Convex-Hull Problems.
COURSE OBJECTIVE: Apply important algorithmic design paradigms and methods of analysis.
1. Give the general plan for divide-and-conquer algorithms. (APRIL/MAY 2008)(NOV/DEC
2008)(MAY/JUNE 2016)
The general plan is as follows.
A problems instance is divided into several smaller instances of the same problem, ideally
about the same size
The smaller instances are solved, typically recursively.
If necessary the solutions obtained are combined to get the solution ofthe original problem
Algorithm BinSearch(a,n,x)
//Given an array a[1:n] of elements in nondecreasing
// order, n>0, determine whether x is present
{
low : = 1;
high : = n;
while (low < high) do
{
mid : = [(low+high)/2];
if(x a[mid]) then high:= mid-1;
else if (x a[mid]) then low:=mid + 1;
else return mid;
}
return 0;}
11. Write the Pseudocode for computes the distance between the two closest points?
//Finds distance between two closest points in the plane by brute force
//Input: A list P of n (n ≥ 2) points p1(x1, y1), . . . ,pn(xn, yn)
//Output: The distance between the closest pair of points
d←∞
fori ←1 to n − 1 do
forj ←i + 1 to ndo
d←min(d, sqrt((xi− xj )2 + (yi− yj )2)) //sqrtis square root
return d
16. Design a brute-force algorithm for computing the value of a polynomial p(x)=anxn+an-1xn-1+-
----+a1x----a0 at a given point x0 and determine its worst case efficiency class.(MAY2015)
Number of multiplications needed in the worst case is
T(n) = n + n-1 + n-2 + … + 3 + 2 + 1
= n (n + 1)/2
=n2/2 + n/2
This is an exact formula for the maximum number of multiplications. In general though, analyses
yield upper bounds rather than exact formulae. We say that the number of multiplications is on the
order of n2 , or O(n2).
Cworst(2k)=k+1=log2n+1
Cworst(n)=[log2n]+1=[log2(n+1)]
Cworst(n)=[log2n]+1=[log22i]+1=[log22+log2i]+1
= (1+[log2i])+1=[log2i]+2
Cavg(n) ͌log n.
2
PART-B
1. Define divide and conquer to apply the technique in binary search algorithm and to analysis it.
(APR/MAY 2006) (Ap)
2. Explain in detail in merge sort give an example (APR/MAY 2008) (MAY 2016). (U)
3.What is divide and conquer strategy and explain the binary search with suitable example
problem.(NOV/DEC 2011)(R)
4. Distinguish between Quick sort and Merge sort, and arrange the following numbers in increasing
order using merge sort. (18, 29, 68, 32, 43, 37, 87, 24, 47, 50) (NOV/DEC 2011) (MAY/JUNE
2013). (U)
5. Trace the steps of Mergesort algorithm for the elements 122,25,70,175,89,90,95,102,123 and also
compute its time complexity.(NOV/DEC 2012) (Ap)
6. Explain brute-force approach. What are the advantages and disadvantages of this approach? (R)
7. Write an algorithm to perform binary search on a sorted list of elements. Analyze the algorithm for
the best case, average case and worst case.(APR/MAY 2011). (An)
8. Using the divide and conquer approach to find the maximum and minimum in a set of ‘n’ elements.
Also find the recurrence relation for the number of elements compared and solve. (APR2011).(C)
9. Explain Closest-pair and Convex-Hull problems by Brute Force? (R)
10. Explain Exhaustive Search? (R)
11. Write an efficient and exhaustive search algorithm for the travelling salesman problem?(U)
12. Trace maximum and minimum (using divide and conquer) algorithm for the following set of
numbers. 20, 35, 18, 8, 14, 41, 3, 39,-20. (Ap)
13. Write a pseudo code using divide and conquer technique for finding the position of the largest
element in an array of N numbers. (An)
14. Sort the following set of elements using merge sort: 12, 24, 8, 71, 4, 23, 6, 89, 56.(Ap)
15. Explain in detail quick sorting method. Provide a complete analysis of quick sort. (R)
(APR/MAY 2008)
16. Explain in detail the merge sort. Illustrate the algorithm with a numeric example. Provide
complete analysis of the same. (APR/MAY 2008) (R)
17. (i) Solve the following using Brute force algorithm: (MAY 2015) (Ap)
Find whether the given string follows the special pattern and return 0 or 1 accordingly.
II Year / IV Sem 12
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
Examples:
1. Pattern: “abba”, input: “redblueredblue’ should return 1.
2. Pattern: “aaaa”, input: “asdasdasdasd” should return 1.
3. attern: “aabb”, input: “xyzabcxzyabc” should return 0.
(ii) Explain the convex hull problem and the solution involved behind it. (U)
18. A pair contains two numbers and its second number is on the right side of the first one in an array.
The difference of a pair is the minus result while subtracting the second number from the first one.
Implement a function which gets the maximal difference of all pairs in an array(using divide and
conquer method). (MAY 2015) (C)
19. Explain the method used for performing Multiplication of two large integers. Explain how
divide and conquer method can be used to solve the same. (MAY\JUNE 2016). (U)
COURSE OBJECTIVE: Apply important algorithmic design paradigms and methods of analysis.
5. Write the difference between the Greedy method and Dynamic programming.(APRIL/MAY
2011)(NOV/DEC 2012)
7.Give the time complexity and space complexity of traveling salesperson problem.
Time complexity is O (n2 2n).
Space complexity is O (n 2n).
The cost of a path from s to t is the sum of the costs of the edges on the path.
The multistage graph problem is to find a minimum-cost path from s to t.
17. What is the difference between dynamic programming and greed algorithm?(APRIL/MAY
2012)
S.No. GREEDY ALGORITHM DYNAMIC PROGRAMMING
1. 1. GA computes the solution in bottom up DA computes its solution by making
technique. It computes the solution from itschoices in a serial fashion (never
smaller sub-routines and tries many look backirrevocable).
possibilities and choices before it arrives at
the optimal set of choices.
2. It does not use the principle of optimality, i.e. It uses the principle of optimality.
there is no test by which one
can tell GA will lead to an optimal solution.
II Year / IV Sem 15
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
A binary search tree is one of the most important data structures in computer science. One of its
principal applications is to implement a dictionary, a set of elements with the operations of searching,
insertion, and deletion. If probabilities of searching for elements of a set are known—e.g., from
accumulated data about past searches—it is natural to pose a question about an optimal binary search
tree for which the average number of comparisons in a search is the smallest possible.
21. Write down the optimization technique used for Warshalls algorithm. State the rules and
assumptions which are implied behind that. (MAY 2015)
Warshalls algorithm constructs the transitive closure of given digraph with n vertices through a series
of n-by-n Boolean matrices. The computations in warshalls algorithm are given by following
sequences,
R(0),…,R(k-1),…,R(k),…,R(n)
Rules:
1.Start with computation of R(0). In R(0) any path with intermediate veritices is not allowed. That
means only direct edges towards the vertices are considered. In other words the path length of one
edge is allowed in R(0). Thus R(0) is adjacency matrix for the digraph.
2. Construct R(1) in which first vertex is used as intermediate vertex and a path length of two edge is
allowed. Note that R(1)vis build using R(0)which is already computed.
3. Go on building R(k) by adding one intermediatr vertex each time and with more path length. Each
R(k) has to be built from R(k-1)
4. The last matrix in this series is R(1), in this R(n) all the n vertices are used as intermediate vertices.
And the R(n) which is obtained is nothing but the transitive closure of given digraph.
22. List out the memory functions used under Dynamic programming. (MAY 2015)
Memory functions solve in a top-down manner only sub problems that are necessary. Memory
functions are an improvement of dynamic programming because they only solve sub problems that
are necessary and do it only once. However they require more because it makes recursive calls which
require additional memory.
Greedy Algorithm
II Year / IV Sem 16
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
PART –B
1. (i)Write an algorithm to construct the optimal binary search tree (or) Discuss the algorithm
for finding a minimum cost binary search trees.(8) (R)
(ii) Explain how dynamic programming is applied to solve travelling salesperson problem.
(APR/MAY 2010)(NOV/DEC 2012)(8) (U)
2. Describe traveling sales man problem and how to solve using dynamic programming
(APR/MAY2009) (APR/MAY 2012)(U)
3. Write an algorithm for all pairs shortest path algorithm and what are the time and space
complexity of the algorithm. (APIRL/MAY2009) (APRIL/MAY 2012)(U)
4. To consider the following instance of the knapsack problem n=6 ,(p1,p2,p3,p4 ,p5
,p6)=(w1,w2,w3,w4,w5,w6)=(100,50,20,10,10,7,3) m=165 To use dynamic programming
technique to solve the problem.(Ap)
5. Explain Floyd algorithm with example 8.Write down and explain the algorithm to solve all
pairs shortest paths problem.(APRIL/MAY 2010)(MAY/JUNE 2013).(U)
6. Using Dynamic approach programming, solve the following graph using the Backward
approach. (APRIL/MAY 2011)(An)
7. Write dynamic programming solution for the travelling salesperson problem for the
network with the cost adjacency matrix.(Ap)
0 10 15 30
4 0 9 11
5 13 0 10
7 7 8 0
8. Describe binary search tree with three traversal patterns? Give suitable example with neat
diagram for all three traversal of binary search?(An)
9. With a suitable example, explain all-pair shortest paths problem.(U)
II Year / IV Sem 17
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
10. How is dynamic programming applied to solve the travelling salesperson problem? Explain in
detail with an example?(An)
11. (i) Given the mobile numeric key pad. You can only press buttons that are up,left,right or
down to the first number pressed to obtain the subsequent numbers. You are not allowed to
press bottom row corner buttons (ie * and #). Given a number N, how many key strokes will
be involved to press the given number. What is the length of it? Which dynamic
programming technique could be used to find solution for this? Explain each step with the
help of a pseudo code and derive its time complexity. (12) (MAY 2015)(E)
(ii) How do you construct a minimum spanning tree using Kruskals algorithm?
Explain?(4) (MAY 2015) (U)
12. (i) Let A ={l/119,m/96,c/247,g/283,h/72,f/77,k/92,j/19} be the letters and its frequency of
distribution in a text file. Compute a suitable Huffman coding to compress the data
effectively. (8)(MAY 2015)(C)
(ii) Write an algorithm to construct the optimal binary search tree given the roots r(i,j)
,0≤i≤j≤n. Also prove that this could be performed in time O(n). (8)(MAY 2015) (Ev)
13. Discuss about the algorithm and pseudocode to find the Minimum Spanning Tree using
Prim’s Algorithm. Find the Minimum Spanning Tree for the graph. Discuss about the
efficiency of the algorithm.(MAY\JUNE 2016) (An)
COURSE OUTCOMES:
Describe the greedy paradigm and explain when an algorithmic design situation calls for it.
Recite algorithms that employ this paradigm. Synthesize greedy algorithms, and analyze them.
UNIT IV
ITERATIVE IMPROVEMENT
SYLLABUS: The Simplex Method-The Maximum-Flow Problem – Maximum Matching in
Bipartite Graphs- the Stable marriage Problem.
COURSE OBJECTIVE: Equip the students with mathematical concepts required to analyze and
design computer algorithms.
PART - A
1. Define Simplex Method.
The simplex method is a method for solving problems in linear programming. This method, invented
by George Dantzig in 1947, tests adjacent vertices of the feasible set (which is a polytope) in
sequence so that at each new vertex the objective function improves or is unchanged. The simplex
method is very efficient in practice, generally taking to iterations at most (where is the
number of equality constraints), and converging in expected polynomial time for certain distributions
of random inputs (Nocedal and Wright 1999, Forsgren 2002).
zero, defines a straight line. Such a line divides the plane into twohalf-planes: for all the points in one
of them, ax + by < c, while for all the pointsin the other, ax + by > c.
The maximum flow problem can be seen as a special case of more complex network flow problems,
such as the circulation problem. The maximum value of an s-t flow (i.e., flow from source s to sink t)
is equal to the minimum capacity of an s-t cut (i.e., cut severing s from t) in the network, as stated in
the max-flow min-cut theorem.
8. Define BipartiteGraphs?
A bipartite graph, also called a bigraph, is a set of graph vertices decomposed into two disjoint sets
such that no two graph vertices within the same set are adjacent. A bipartite graph is a special case of
a k-partite graphwith . The illustration above shows some bipartite graphs, with vertices in each
graph colored based on to which of the two disjoint sets they belong.
II Year / IV Sem 19
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
PART –B
1. Explain the following: (R)
a. Blocking pair
b. Stable Marriage Problem
2. Write a pseudocode for the stable marriage algorithm. (R)
3. Determine the time-efficiency class of the stable marriage algorithm(An)
a. In the worst case
b. In the best case
4. Explain the algorithm for Maximum Bipartite Matching. (R)
5. Explain the simplex method. (U)
6. Example Geometric Interpretation of Linear Programming.(R)
7. Explain Extreme Point Theorem? (R)
8. Write a report on the following: (U)
a. Two-phase simplex method.
b. Ellipsoid method.
c. Bland’s rule
d. Teasible and optimal solutions
9. (i)Maximize p=2x+3y+z (MAY 2015) (C)
Subject to x+y+z≤40
2x+y-z≥10
-y+z≥10
x≥0,y≥0,z≥0
(ii) Write down the optimally condition and algorithmic implementation for finding M-
augmenting paths in bipartite graphs. (MAY 2015) (An)
II Year / IV Sem 20
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
1
u v
10
2 3 9 4 6
s
7
5
x y
2
COURSE OUTCOMES: Apply mathematical concepts to the analyses and design stages of
different types of algorithms.
UNIT-V
COPING WITH THELIMITATIONS OFALGORITHMPOWER
PART - A
2.What are the factors that influence the efficiency of the backtracking
algorithm?(APRIL/MAY 2008)
The efficiency of the backtracking algorithm depends on the following four
factors. They are:
i. The time needed to generate the next xk
ii. The number of xk satisfying the explicit constraints.
iii. The time for the bounding functions Bk
iv. The number of xk satisfying the Bk.
II Year / IV Sem 22
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
sequence of n+1 adjacentverticesvi0, vi1… vin-1, vi0 where the first vertex of the sequence is same
as the last one while all the other n-1 vertices are distinct.
11. What is the method used to find the solution in n-queen problem by symmetry?
The board of the n-queens problem has several symmetries so thatsome solutions can be obtained by
other reflections. Placements in the lastn/2 columns need not be considered, because any solution
with the first queen in square can be obtained by reflection from a solutionwith the first queen in
square (1,n-i+1)
Explicit constraints
Implicit constraints
The tree organization of the solution space is referred to as state space tree.
Dead node is defined as a generated node, which is to be expanded further all of whose
children have been generated.
II Year / IV Sem 24
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
A search path at the current node in a state-space tree of a branch and-bound algorithm can be
terminated if the value of the node’s bound is not better than the value of the best solution seen so far
the node represents no feasible solution because the constraints of the problem are already violated.
The subset of feasible solutions represented by the node consists of asingle point in this case compare
the value of the objective function for this feasible solution with that of the best solution seen so far
andupdate the latter with the former if the new solution is better.
30.Give the formula used to find the upper bound for knapsack problem.
A simple way to find the upper bound ‘ub’ is to add ‘v’, the total valueof the items already selected,
the product of the remaining capacity of theknapsack W-w and the best per unit payoff among the
remaining items, whichis vi+1/wi+1, ub = v + (W-w)( vi+1/wi+1)
II Year / IV Sem 25
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
If there is a polynomial algorithm for any NP-hard problem, then there are polynomial algorithms
for all problems in NP, and hence P = NP.
If P ≠ NP, then NP-hard problems cannot be solved in polynomial time, while P = NP does not
resolve whether the NP-hard problems can be solved in polynomial time.
These are the problems that are even harder than the NP-complete problems. Note that NP-hard
problems do not have to be in NP, and they do not have to be decision 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.
But since any NP-complete problem can be reduced to any other NP-complete problem in
polynomial time, all NP-complete problems can be reduced to any NP-hard problem in polynomial
time. Then, if there is a solution to one NP-hard problem in polynomial time, there is a solution to all
NP problems in polynomial time.
Hamiltonian circuit problem Determine whether a given graph has a Hamiltonian circuit—a path that
starts and ends at the same vertex and passes through all the other vertices exactly once.
31. State Assignment problem. (MAY\JUNE 2016)
There are n people who need to be assigned to execute n jobs, one person per job. (That is, each
person is assigned to exactly one job and each job is assigned to exactly one person.) The cost that
would accrue if the ith person is assigned to the jth job is a known quantity [ , ] for each pair , = 1, 2,
. . . , . The problem is to find an assignment with the minimum total cost.
34. What is The Euclidean minimum spanning tree problem? (MAY\JUNE 2016)
The Euclidean minimum spanning tree or EMST is a minimum spanning tree of a set of n Points in
the plane where the weight of the edge between each pair of points is the Euclidean distance between
II Year / IV Sem 26
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
those two points. In simpler terms, an EMST connects a set of dots using lines such that the total
length of all the lines is minimized and any dot can be reached from any other by following the lines.
PART –B
1. Explain the n-Queen’s problem & discuss the possible solutions.(APRIL/MAY2008)
(APRIL/MAY2009)(NOV/DEC 2008)(An)
2. Apply backtracking technique to solve the following instance of subset sum problem :
S={1,3,4,5} and d=11(NOV/DEC 2006)(Ap)
3. Explain subset sum problem & discuss the possible solution strategies using backtracking.(An)
4. Write a recursive backtracking algorithm to find all the Hamiltonian cycles of a given graph.
(APRIL/MAY2009) (NOV/DEC 2008)(E)
5. What is backtracking explain detail (APR/MAY 2007)(R)
6. Explain graph coloring in detail. (APR/MAY2009)(U)
7. Give the backtracking algorithm for knapsack problem.(U)
8. Explain the algorithm for finding all m-colorings of a graph.(APRIL/MAY 2012)(U)
9. Describe the backtracking solution to solve 8-Queens problem.(APRIL/MAY 2010)(U)
(APRIL/MAY2012)
10.With an example, explain Graph Coloring Algorithm.(APRIL/MAY 2010)(U)
11. Explain the n-Queen’s problem and trace it for n=6.(APRIL/MAY 2011)(An)
12.(i)Explain Hamiltonian cycles.(NOV/DEC 2012)(8)(U)
(ii) With an example, explains Graph Coloring Algorithm.(8)(U)
13. (i)Explain the control abstraction for Backtracking method. Describe the backtracking solution to
solve 8-Queens problem. (8)(NOV/DEC 2012)(An)
(ii) Let w= {5, 7, 10, 12, 15, 18, 20} and m=35.Find all possible subset of w whose sum is equivalent
to m.Draw the portion of state space tree for this problem. (8)(An)
14. How backtracking works on 8-Queens problem with suitable example?(MAY/JUNE 2013)(U)
15.(i) Give the backtracking algorithm for knapsack problem. (MAY/JUNE 2013) (8)(U)
(ii) Explain elaborately recursive backtracking algorithm. (8)(R)
16. Using backtracking, find the optimal solution to a knapsack problem for the knapsack instance
n=8, m=110,(p1…p7)=(11,21,31,33,43,53,55,65) and (w1…w7)=(1,11,21,33,43,53,55,65).(C)
17. Write an algorithm to determine Hamiltonian cycle in a given graph using back tracking. For
the following graph determine the Hamiltonian cycle.(U)
A B
C F
D E
II Year / IV Sem 27
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
18. Write an algorithm to determine the Sum of Subsets for a given sum and a Set of numbers. Draw
the tree representation to solve the subset sum problem given the numbers set as {3, 5, 6, 7, 2}
with the sum=15. Derive all the subsets.(E)
19. Write an algorithm for N QUEENS problem and Trace it for n=6.(An)
20. What is Branch and bound? Explain in detail.(MAY/JUNE 07) (APIRL/MAY2009)(NOV/DEC
2008)(R)
21. (i)Suggest an approximation algorithm for travelling salesperson problem. Assume that the cost
function satisfies the triangle inequality. (MAY 2015)(E)
(ii)Explain how job assignment problem could be solved, given n tasks and n agents where where
each agent has a cost to complete each task, using branch and bound. (MAY 2015)(An)
22. (i)The knight is placed on the first block of an empty board and, moving according to the rules of
chess, must visit each square exactly once. Solve the above problem using backtracking
procedure. (MAY 2015)(An)
(ii)Implement an algorithm for Knapsack problem using NP-Hard approach. (MAY 2015)(An)
23. State the subset-sum problem and Complete state-space tree of the backtracking algorithm
applied to the instance A={3, 5, 6, 7} and d=15 of the subset-sum problem.(MAY\JUNE
2016)(Ap)
COURSE OUTCOMES: Ability to apply algorithm design techniques to solve certain NP-complete
problems.
II Year / IV Sem 28
PANIMALAR INSTITUTE OF TECHNOLOGY DEPARTMENT OF IT
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
C212.1 3 3 - 2 - - - - - - - 2
C212.2 3 2 - 2 - - - - - - - 1
C212.3 2 2 - 2 - - - - - - - 1
C212.4 3 2 - 2 - - - - - - - 1
C212.5 2 1 - 2 - - - - - - - 2
CO – PSO MATRIX:
II Year / IV Sem 29