Jawaharlal Nehru Technological University Hyderabad

Jawaharlal Nehru Technological University Hyderabad B.Tech IV ADVANCED ALGORITHMS Previous Question Paper (July/August - 2022 - R16)

B.Tech | IV | II | R16 | July/August - 2022

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

Answer any five questions. All questions carry equal marks.

Main

115 marks
a

Explain the algorithm of quick sort with an example.

7 marks

Answer

Quick sort is a divide-and-conquer algorithm that picks an element as a pivot and partitions the array around it. The process involves:

  1. Pick an element as the pivot from the array.
  2. Partitioning: Reorder the array so that all elements with values less than the pivot come before it, and all elements with values greater than the pivot come after it.
  3. Recursively apply the above steps to the sub-array of elements with smaller values and the sub-array of elements with greater values.

Example: Consider array [10, 80, 30, 90, 40]. Choosing 40 as the pivot: After partitioning, elements smaller than 40 (10, 30) move to the left, and elements larger (80, 90) move to the right. The array becomes [10, 30, 40, 80, 90]. The process repeats for sub-arrays [10, 30] and [80, 90] until the entire array is sorted.

b

Write an algorithm of Longest Common Subsequence.

8 marks

Answer

The Longest Common Subsequence (LCS) problem finds the longest subsequence present in two sequences. Given sequences X of length m and Y of length n, the algorithm uses dynamic programming with a table L[m+1][n+1]:

Algorithm LCS(X, Y, m, n)
for i = 0 to m:
    L[i][0] = 0
for j = 0 to n:
    L[0][j] = 0
for i = 1 to m:
    for j = 1 to n:
        if X[i-1] == Y[j-1]:
            L[i][j] = L[i-1][j-1] + 1
        else:
            L[i][j] = max(L[i-1][j], L[i][j-1])
return L[m][n]

The value L[m][n] contains the length of the LCS. To reconstruct the sequence, one can backtrack from L[m][n] to L[0][0], moving diagonally when characters match and following the direction of the maximum value otherwise.

215 marks
a

Write an algorithm of Optimal Binary Search Tree.

8 marks

Answer

Sign in to view the complete answer paper.

b

Sort the following list of elements by using randomized heap sort: 54, 89, 20, 77, 10, 46, 92, 36.

7 marks

Answer

Sign in to view the complete answer paper.

315 marks
a

Write an algorithm of Kruskal’s minimum cost spanning tree.

8 marks

Answer

Sign in to view the complete answer paper.

b

Explain about Amortized Analysis.

7 marks

Answer

Sign in to view the complete answer paper.

415 marks
a

Explain about the activity selection problem with an example.

7 marks

Answer

Sign in to view the complete answer paper.

b

Write an algorithm of Max Flow problem.

8 marks

Answer

Sign in to view the complete answer paper.

515 marks
a

Derive the time complexity of Strassen’s Matrix multiplication.

8 marks

Answer

Sign in to view the complete answer paper.

b

Explain about the Zero – one principle.

7 marks

Answer

Sign in to view the complete answer paper.

6

Explain about the merging networks with an example.

15 marks

Answer

Sign in to view the complete answer paper.

715 marks
a

Apply the Rabin-Karp algorithm for the text 314593671028 and pattern 67. Illustrate the intermediate steps.

7 marks

Answer

Sign in to view the complete answer paper.

b

Write an algorithm of Naïve String Pattern and also find the time complexity of the same.

8 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

Explain about the NP-Complete and also explain any one NP-Complete problem with an example.

7 marks

Answer

Sign in to view the complete answer paper.

b

Explain about the Travelling Sales Person problem by using an approximation algorithm.

8 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the question paper of ADVANCED ALGORITHMS from Jawaharlal Nehru Technological University Hyderabad for B.Tech CSE IV II, July/August - 2022, R16.

For the solved question paper with answers, switch to the Answer Paper tab.

Other papers in ADVANCED ALGORITHMS

Loading Question Papers

Fetching data from database...