sureshvcetit.files.wordpress.com …  · web viewperson1 9 2 7 8. person 2 6 4 3 7. person 3 5 8 1...

12
VELAMMAL COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY QUESTION BANK SUBJECT : CS6402 - Design and Analysis of Algorithms DATE:28.03.18 SEM / YEAR: IV Sem/ II Year BATCH: 2016 – 2020 Part – A (10 * 2 = 20) 1. Define Notion of Algorithm. (Remember) CO1 An algorithm is a sequence of unambiguous instructions for solving a problem, i.e., for obtaining a required output for any legitimate input in a finite amount of time. 2. Write down the properties of asymptotic notations. (Remember) CO1 Symmetry f(n) = Θ(g(n)) if and only if g(n) = Θ(f(n)) Transpose Symmetry f(n) = O(g(n)) if and only if g(n) = Ω(f(n)) f(n) = o(g(n)) if and only if g(n) = ω(f(n)) 3. Define convex hull by Brute Force. (Remember) CO2 The convex hull of a set S of points is the smallest convex set containing S. (The smallest requirement means that the convex hull of S must be a subset of any convex set containing S). 4. What are the variations of merge sort? (Remember) CO2

Upload: others

Post on 16-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: sureshvcetit.files.wordpress.com …  · Web viewPerson1 9 2 7 8. Person 2 6 4 3 7. Person 3 5 8 1 8. Person 4 7 6 9 4. Solve the all-pairs shortest path problem for the digraph

VELAMMAL COLLEGE OF ENGINEERING AND TECHNOLOGY

DEPARTMENT OF INFORMATION TECHNOLOGY

QUESTION BANK

SUBJECT : CS6402 - Design and Analysis of Algorithms DATE:28.03.18

SEM / YEAR: IV Sem/ II Year BATCH: 2016 – 2020

Part – A (10 * 2 = 20)

1. Define Notion of Algorithm. (Remember) CO1

An algorithm is a sequence of unambiguous instructions for solving a problem, i.e., for obtaining a required output for any legitimate input in a finite amount of time.

2. Write down the properties of asymptotic notations. (Remember) CO1

Symmetry

f(n) = Θ(g(n)) if and only if g(n) = Θ(f(n))

Transpose Symmetry

f(n) = O(g(n)) if and only if g(n) = Ω(f(n)) f(n) = o(g(n)) if and only if g(n) = ω(f(n))

3. Define convex hull by Brute Force. (Remember) CO2

The convex hull of a set S of points is the smallest convex set containing S. (The smallest requirement means that the convex hull of S must be a subset of any convex set containing S).

4. What are the variations of merge sort? (Remember) CO2

First, thealgorithm can be implemented bottom up by merging pairs of the array’s elements,then merging the sorted pairs, and so on. This avoids the time and space overhead of using a stack to handle recursive calls.Second, we can divide a list to be sorted in more than two parts, sort each recursively, and then merge them together. This scheme, which is particularly useful for sorting files residing on secondary memory devices, is called multiway mergesort.

5. What is meant by principle of optimality? (Remember) CO3

The principle of optimality is the basic principle of dynamic programming, which was developed by Richard Bellman: that an optimal path has the property that whatever the initial conditions and control variables (choices) over some initial period, the control (or decision variables) chosen over the remaining period must be

Page 2: sureshvcetit.files.wordpress.com …  · Web viewPerson1 9 2 7 8. Person 2 6 4 3 7. Person 3 5 8 1 8. Person 4 7 6 9 4. Solve the all-pairs shortest path problem for the digraph

optimal for the remaining problem, with the state resulting from the early decisions taken to be the initial condition.

6. Define fringe vertex. (Remember) CO3

Vertices adjacent to tree vertices but not yet visited

7. Define the Iterative improvement technique. (Remember) CO4The objective function is the function that problem seeks to maximize or minimize. Iterative improvement is frequently used in numerical problems, for example root finding or finding the

maximum of a function. We will concentrate on iterative improve to graph problems.

8. Define Blocking pair. (Remember) CO4

A pair (m, w) is called a blocking pair for a marriage matching, M, if both m and w prefer each other more than

there mate in the marriage, M.

9. Explain whether backtracking algorithm always produces optimal. (Understand) CO5

Yes, the idea of the backtracking can be further enhanced by evaluation the quality of partially

constructed solution.

10. How is the accuracy of the approximation algorithms measured? Remember) CO5

The accuracy ratio

Part – B (5 * 13 = 65)

1. i)Suppose W satisfies the following recurrence equation and base case

(where c is a constant): W(n) = c.n+W(n/2) and W(1) =1.

What is the asymptotic order of W(n)(Apply) Ans: W(n) = O(log n) 5 marks

CO1

(ii) Make use of two queues implement a stack. Identify the running time of the stack operations.

(Apply) CO1

Explanation with neat sketch 8 marks

OR

2. What are the properties of Asymptotic notations and derive it. (Understand) CO1

Page 3: sureshvcetit.files.wordpress.com …  · Web viewPerson1 9 2 7 8. Person 2 6 4 3 7. Person 3 5 8 1 8. Person 4 7 6 9 4. Solve the all-pairs shortest path problem for the digraph

Properties of asymptotic notations 4 marks

Proof of each property 9 marks1. Transitive

If f(n) = Θ(g(n)) and g(n) = Θ(h(n)), then f(n) = Θ(h(n)) If f(n) = O(g(n)) and g(n) = O(h(n)), then f(n) = O(h(n)) If f(n) = o(g(n)) and g(n) = o(h(n)), then f(n) = o(h(n)) If f(n) = Ω(g(n)) and g(n) = Ω(h(n)), then f(n) = Ω(h(n)) If f(n) = ω(g(n)) and g(n) = ω(h(n)), then f(n) = ω(h(n))

2. Reflexivity f(n) = Θ(f(n)) f(n) = O(f(n)) f(n) = Ω(f(n))

3. Symmetry f(n) = Θ(g(n)) if and only if g(n) = Θ(f(n))

4. Transpose Symmetry f(n) = O(g(n)) if and only if g(n) = Ω(f(n)) f(n) = o(g(n)) if and only if g(n) = ω(f(n))

5. Some other properties of asymptotic notations are as follows: If f (n) is O(h(n)) and g(n) is O(h(n)), then f (n) + g(n) is O(h(n)). The function loga n is O(logb n) for any positive numbers a and b ≠ 1. loga n is O(lg n) for any positive a ≠ 1, where lg n = log2 n.3. Apply quick sort to sort the list E, X, A, M, P, L, E in alphabetical order. Draw the tree of the

recursive calls made. (Apply) CO2

Page 4: sureshvcetit.files.wordpress.com …  · Web viewPerson1 9 2 7 8. Person 2 6 4 3 7. Person 3 5 8 1 8. Person 4 7 6 9 4. Solve the all-pairs shortest path problem for the digraph

Quick sort Procedure 2 marks

Explanation with workout problem 7 marks

Tree of Recursive Call 4 marks

OR

4. There are 4 people who need to be assigned to execute 4 jobs(one person per job) and the problem is to find an assignment with the minimum total cost. The assignment costs is given below, solve the assignment problem by exhaustive search. (Apply) CO2

Job1 Job2 Job3 Job4Person1 9 2 7 8Person 2 6 4 3 7Person 3 5 8 1 8Person 4 7 6 9 4

5. Solve the all-pairs shortest path problem for the digraph with the following weight matrix. (Apply) CO3

Page 5: sureshvcetit.files.wordpress.com …  · Web viewPerson1 9 2 7 8. Person 2 6 4 3 7. Person 3 5 8 1 8. Person 4 7 6 9 4. Solve the all-pairs shortest path problem for the digraph

OR6. Consider the following graph. Explain the list of edges in the MST in the order that Prim’s

algorithm inserts them. Start Prim’s algorithm from Vertex A. (Apply) CO3

Prim’s algorithm explained with problem solving 10 marks

Path calculation 3 marks

7. Consider an instance of the stable marriage problem given by the ranking matrix. (Apply) CO4

For each of its marriage matching’s, indicate whether it is stable or unstable matching’s, specify a blocking pair. For the stable matching, indicate whether they are man-optimal, woman-optimal or neither. (Assume that the Greek and English letters denote the men and women respectively)

Page 6: sureshvcetit.files.wordpress.com …  · Web viewPerson1 9 2 7 8. Person 2 6 4 3 7. Person 3 5 8 1 8. Person 4 7 6 9 4. Solve the all-pairs shortest path problem for the digraph

OR

Page 7: sureshvcetit.files.wordpress.com …  · Web viewPerson1 9 2 7 8. Person 2 6 4 3 7. Person 3 5 8 1 8. Person 4 7 6 9 4. Solve the all-pairs shortest path problem for the digraph

8. Test for the following theorem: “The value of a maximum flow in a network is equal to the capacity of its minimum cut”. (Analyze) CO4

Theorem Proof explanation 8 amrksProof (solvable problem) 5 marks

9. Solve the following instance of the Knapsack problem by branch and bound algorithm. Knapsack capacity W=10 using Approximation Algorithm. (Analyze) CO5

Value to weight ratio 2 marks

State Space Tree 10 marks

Result Set 1 mark

OR

Page 8: sureshvcetit.files.wordpress.com …  · Web viewPerson1 9 2 7 8. Person 2 6 4 3 7. Person 3 5 8 1 8. Person 4 7 6 9 4. Solve the all-pairs shortest path problem for the digraph

10. Apply backtracking to the problem of finding a Hamiltonian circuit in the following graph. (Apply) CO5 Hamiltonian Circuit -- > State Space tree 8 marksHamiltonian Path finding with node numbering 3 marksExplanation 2 marks

Part – C (1 * 15 = 15)

1. Solve the following recurrence relations:(Apply) CO1

a) x(n) = x(n-1) + 5 for n>1; x(1) = 0b) x(n) = 3x(n-1) for n>1; x(1) = 4c) x(n) = x(n-1) + n for n>0; x(1) = 0d) x(n) = x(n/2) + n for n>1; x(1) = 1 (solve for n=2k)e) x(n) = x(n/3) + 1 for n>1; x(1) = 1(solve for n=2k)

Each one carries 3 marks

Page 9: sureshvcetit.files.wordpress.com …  · Web viewPerson1 9 2 7 8. Person 2 6 4 3 7. Person 3 5 8 1 8. Person 4 7 6 9 4. Solve the all-pairs shortest path problem for the digraph
Page 10: sureshvcetit.files.wordpress.com …  · Web viewPerson1 9 2 7 8. Person 2 6 4 3 7. Person 3 5 8 1 8. Person 4 7 6 9 4. Solve the all-pairs shortest path problem for the digraph

OR

2. Apply the bottom-up dynamic programming algorithm to the following instance of the knapsack problem: (Apply) CO3

Page 11: sureshvcetit.files.wordpress.com …  · Web viewPerson1 9 2 7 8. Person 2 6 4 3 7. Person 3 5 8 1 8. Person 4 7 6 9 4. Solve the all-pairs shortest path problem for the digraph

Course Incharge Module Coordinator Verified ByMr. Suresh Babu P, AP III/IT Mrs.D.Anandhavalli HoD/IT