JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech IV ADVANCED ALGORITHMS Previous Question Paper (February/March - 2022 - R18)

B.Tech | IV | I | R18 | February/March - 2022

Answer PaperPaper Code: 157ACMaximum Marks: 75Time: 3 Hours

Answer Any Five Questions. All Questions carry equal marks.

Main

115 marks
a

Write an algorithm of OBST.

7 marks

Answer

The Optimal Binary Search Tree (OBST) algorithm constructs a binary search tree with minimum search cost given a set of keys and their associated probabilities. Let P[i] be the probability of searching for key i and Q[i] be the probability of searching for a value between keys i and i+1.

  1. Initialize a cost table C[1..n+1, 0..n] and a root table R[1..n, 1..n] to zero.
  2. For i = 1 to n, set C[i, i-1] = Q[i-1] and W[i, i-1] = Q[i-1].
  3. For length L = 1 to n:
  4. For i = 1 to n-L+1:
  5. Set j = i+L-1.
  6. Calculate W[i, j] = W[i, j-1] + P[j] + Q[j].
  7. Find k in range [i, j] that minimizes C[i, k-1] + C[k+1, j].
  8. Set C[i, j] = W[i, j] + min(C[i, k-1] + C[k+1, j]) and R[i, j] = k.
b

Derive the time complexity of quick sort in an average case.

8 marks

Answer

The average case time complexity of Quick Sort is derived using the recurrence relation T(n) = (n-1) + (1/n) ∑ [T(i-1) + T(n-i)] for i=1 to n, where (n-1) is the partitioning cost.

  1. The recurrence simplifies to T(n) = (n-1) + (2/n) ∑ T(i) for i=0 to n-1.
  2. Multiplying by n gives nT(n) = n(n-1) + 2 ∑ T(i).
  3. Subtracting the equation for (n-1): (n-1)T(n-1) = (n-1)(n-2) + 2 ∑ T(i).
  4. This results in nT(n) - (n-1)T(n-1) = 2(n-1) + 2T(n-1).
  5. Rearranging gives nT(n) = (n+1)T(n-1) + 2(n-1).
  6. Dividing by n(n+1) yields T(n)/(n+1) = T(n-1)/n + 2(n-1)/(n(n+1)).
  7. Summing this telescopic series results in T(n) ≈ 2n ln n, which is O(n log n).
215 marks
a

What is the running time of HEAPSORT on an array A of length n that is already sorted in increasing order? What about decreasing order?

8 marks

Answer

Sign in to view the complete answer paper.

b

Use the substitution method to solve the following recurrence relation

T(n) = 3T(n/2) + n
.

7 marks

Answer

Sign in to view the complete answer paper.

315 marks
a

Write an algorithm of Activity selection algorithm.

8 marks

Answer

Sign in to view the complete answer paper.

b

Explain about Topological sorting.

7 marks

Answer

Sign in to view the complete answer paper.

415 marks
a

State and explain Prim’s algorithm with an example.

8 marks

Answer

Sign in to view the complete answer paper.

b

Write an algorithm of single source shortest path.

7 marks

Answer

Sign in to view the complete answer paper.

515 marks
a

Illustrate the zero-one principle with an example. Prove that an n-input sorting network must contain atleast one comparator between the i-th and (i + 1)-st lines for all i = 1, 2, . . . , n - 1.

7 marks

Answer

Sign in to view the complete answer paper.

b

Explain about Comparision Network.

8 marks

Answer

Sign in to view the complete answer paper.

615 marks
a

Derive the strassen’s matrix multiplication.

10 marks

Answer

Sign in to view the complete answer paper.

b

Explain the applications of merging networks.

5 marks

Answer

Sign in to view the complete answer paper.

7

Write an algorithm of Rabin-Karp and also illustrate with an example.

15 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

What is the vertex-cover problem? Give an example of a graph for which APPROX-VERTEX-COVER always yields a suboptimal solution.

8 marks

Answer

Sign in to view the complete answer paper.

b

Illustrate an Algorithm that computes the traveling-salesman problem with triangle inequality.

7 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the solved question paper with answers of ADVANCED ALGORITHMS from JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD for B.Tech CSE IV I, February/March - 2022, R18.

For the question paper without answers, switch to the Question Paper tab.

Other papers in ADVANCED ALGORITHMS

Loading Question Papers

Fetching data from database...