JNTU

JNTU B.Tech III ALGORITHM DESIGN AND ANALYSIS Previous Question Paper (August/September - 2021 - R18)

B.Tech | III | II | R18 | August/September - 2021

Answer PaperPaper Code: 156ADMaximum Marks: 75Time: 3 Hours

Answer any five questions. All questions carry equal marks.

Main

1

State any two differences between traditional matrix multiplication and Strassen’s matrix multiplication. Discuss Strassen’s matrix multiplication and derive its time complexity.

15 marks

Answer

Traditional matrix multiplication follows the standard row-by-column approach, whereas Strassen’s algorithm utilizes a divide-and-conquer strategy based on block matrices. The primary differences are:

  1. Computational Complexity: Traditional multiplication has a time complexity of O(n3), while Strassen’s algorithm improves this to approximately O(n2.81).
  2. Methodology: Traditional multiplication performs 8 multiplications for 2x2 sub-matrices, whereas Strassen’s algorithm reduces this to 7 multiplications by using specific algebraic combinations, trading increased additions for fewer multiplications.

Strassen’s algorithm divides two n x n matrices A and B into four n/2 x n/2 sub-matrices. Instead of the standard 8 recursive multiplications, it computes 7 intermediate products (P1 through P7) using additions and subtractions of sub-matrices. These products are then combined to form the quadrants of the resulting matrix C.

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) = O(n2):

  1. Compare f(n) = n2 with nlogba = nlog27.
  2. Since log27 ≈ 2.81, we have n2 < n2.81.
  3. According to Case 1 of the Master Theorem, the complexity is T(n) = Θ(nlog27).

Thus, the time complexity is O(n2.81), which is asymptotically faster than the traditional O(n3) method for large matrices.

2

Design merge sort algorithm and discuss its best-case, average-case and worst-case efficiency.

15 marks

Answer

Merge Sort is a divide-and-conquer algorithm that sorts an array by recursively splitting it into two halves, sorting each half, and then merging the sorted halves back together.

The algorithm follows these steps:

  1. Divide: Find the middle point of the array to divide it into two subarrays.
  2. Conquer: Recursively call Merge Sort on both halves until the base case (an array of size 1) is reached.
  3. Combine: Merge the two sorted subarrays into a single sorted array by comparing elements from each subarray and placing the smaller element into the result array.

The efficiency of Merge Sort is determined by the recurrence relation

T(n) = 2T(n/2) + O(n)
, where
O(n)
represents the time taken to merge the subarrays.

Complexity analysis:

  • Best-case efficiency:
    O(n log n)
    . Even if the array is already sorted, the algorithm still recursively divides the array and performs the merge operations.
  • Average-case efficiency:
    O(n log n)
    . The number of comparisons remains consistent regardless of the initial order of elements.
  • Worst-case efficiency:
    O(n log n)
    . The depth of the recursion tree is
    log n
    and each level requires
    n
    operations to merge, resulting in a stable performance across all cases.

Merge Sort is a stable sorting algorithm and requires

O(n)
auxiliary space to store the temporary subarrays during the merge process.

3

How sets are represented in memory? What is a disjoint set? Write algorithm for Union and Find operations of disjoint sets.

15 marks

Answer

Sign in to view the complete answer paper.

4

Write recursive backtracking schema for m coloring of the graph. Determine the time complexity of the same.

15 marks

Answer

Sign in to view the complete answer paper.

5

Solve the instance of 0/1 knapsack problem using dynamic programming: n = 4, m = 25 (P1, P2, P3, P4) = (10, 12, 14, 16), (W1, W2, W3, W4) = (9, 8, 12, 14).

15 marks

Answer

Sign in to view the complete answer paper.

6

Define the Travelling Salesperson Problem. Solve the TSP problem using Dynamic programming where the edge lengths are given as:

0 10 15 20
5 0 9 10
6 13 0 12
8 8 9 0
15 marks

Answer

Sign in to view the complete answer paper.

7

Explain the Greedy Kruskal’s minimum spanning tree. Compare this with Greedy Prim’s method.

15 marks

Answer

Sign in to view the complete answer paper.

8

Write the control abstraction for LC-Search. Explain how Traveling Salesperson problem is solved using LCBB.

15 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the question paper of ALGORITHM DESIGN AND ANALYSIS from JNTU for B.Tech IT III II, August/September - 2021, R18.

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

Other papers in ALGORITHM DESIGN AND ANALYSIS

Loading Question Papers

Fetching data from database...