Jawaharlal Nehru Technological University Hyderabad

Jawaharlal Nehru Technological University Hyderabad B.Tech III DESIGN AND ANALYSIS OF ALGORITHMS Previous Question Paper (February - 2022 - R16)

B.Tech | III | I | R16 | February - 2022

Answer PaperPaper Code: 135AFMaximum Marks: 75Time: 3 hours

Answer any five questions. All questions carry equal marks.

Main

115 marks
a

Give Strassen’s matrix multiplication algorithm and derive the time complexity.

7 marks

Answer

Strassen's algorithm is a divide-and-conquer approach to matrix multiplication that reduces the number of recursive multiplications from 8 to 7. Given two n x n matrices A and B, we divide them into four n/2 x n/2 submatrices. The product C = AB is computed by calculating seven intermediate products P1 through P7:

P1 = (A11 + A22)(B11 + B22)
P2 = (A21 + A22)B11
P3 = A11(B12 - B22)
P4 = A22(B21 - B11)
P5 = (A11 + A12)B22
P6 = (A21 - A11)(B11 + B12)
P7 = (A12 - A22)(B21 + B22)

The resulting submatrices of C are then formed by linear combinations of these products. The recurrence relation for the time complexity is T(n) = 7T(n/2) + O(n2). Applying the Master Theorem where a=7, b=2, and f(n)=n2, we compare nlog2(7) with n2. Since log2(7) is approximately 2.81, which is greater than 2, the complexity is T(n) = O(nlog2(7)) ≈ O(n2.81), which is more efficient than the standard O(n3) algorithm.

b

Illustrate with an example the working of quick sort.

8 marks

Answer

Quick sort uses a divide-and-conquer strategy by selecting a pivot element and partitioning the array such that elements smaller than the pivot are on the left and larger elements are on the right. Consider the array [25, 10, 5, 30, 15].

  1. Select the last element 15 as the pivot.
  2. Partitioning: Compare elements with 15. 10 and 5 are smaller, 25 and 30 are larger. Swap 25 with 10, then 30 with 15. The array becomes [10, 5, 15, 30, 25].
  3. The pivot 15 is now in its correct sorted position.
  4. Recursively apply the same logic to the left sub-array [10, 5] and the right sub-array [30, 25].
  5. For [10, 5], pivot 5 results in [5, 10]. For [30, 25], pivot 25 results in [25, 30].
  6. Combining the results, the final sorted array is [5, 10, 15, 25, 30].

The average time complexity is O(n log n), while the worst-case complexity is O(n2) when the pivot selection consistently results in unbalanced partitions.

215 marks
a

Explain various asymptotic notations for algorithm analysis.

7 marks

Answer

Sign in to view the complete answer paper.

b

Derive the time complexity of binary search.

8 marks

Answer

Sign in to view the complete answer paper.

3

Give the solution to the 8-queens problem using backtracking.

15 marks

Answer

Sign in to view the complete answer paper.

4

Explain the solution to the graph coloring problem using backtracking.

15 marks

Answer

Sign in to view the complete answer paper.

5

Explain the Single source shortest path problem with an example.

15 marks

Answer

Sign in to view the complete answer paper.

6

What is the need for generating a spanning tree? Explain an algorithm for generating spanning tree.

15 marks

Answer

Sign in to view the complete answer paper.

7

Discuss the time and space complexity of Dynamic Programming traveling sales person algorithm.

15 marks

Answer

Sign in to view the complete answer paper.

8

Explain the LC branch and bound algorithm.

15 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the question paper of DESIGN AND ANALYSIS OF ALGORITHMS from Jawaharlal Nehru Technological University Hyderabad for B.Tech IT III I, February - 2022, R16.

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

Other papers in DESIGN AND ANALYSIS OF ALGORITHMS

Loading Question Papers

Fetching data from database...