JNTU
JNTU B.Tech III ALGORITHM DESIGN AND ANALYSIS Previous Question Paper (August/September - 2021 - R18)
Answer any five questions. All questions carry equal marks.
Main
State any two differences between traditional matrix multiplication and Strassen’s matrix multiplication. Discuss Strassen’s matrix multiplication and derive its time complexity.
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:
- Computational Complexity: Traditional multiplication has a time complexity of O(n3), while Strassen’s algorithm improves this to approximately O(n2.81).
- 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:
Applying the Master Theorem where a = 7, b = 2, and f(n) = O(n2):
- Compare f(n) = n2 with nlogba = nlog27.
- Since log27 ≈ 2.81, we have n2 < n2.81.
- 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.
Design merge sort algorithm and discuss its best-case, average-case and worst-case efficiency.
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:
- Divide: Find the middle point of the array to divide it into two subarrays.
- Conquer: Recursively call Merge Sort on both halves until the base case (an array of size 1) is reached.
- 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
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 islog nand each level requiresnoperations to merge, resulting in a stable performance across all cases.
Merge Sort is a stable sorting algorithm and requires
How sets are represented in memory? What is a disjoint set? Write algorithm for Union and Find operations of disjoint sets.
Answer
Sign in to view the complete answer paper.
Write recursive backtracking schema for m coloring of the graph. Determine the time complexity of the same.
Answer
Sign in to view the complete answer paper.
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).
Answer
Sign in to view the complete answer paper.
Define the Travelling Salesperson Problem. Solve the TSP problem using Dynamic programming where the edge lengths are given as:
5 0 9 10
6 13 0 12
8 8 9 0
Answer
Sign in to view the complete answer paper.
Explain the Greedy Kruskal’s minimum spanning tree. Compare this with Greedy Prim’s method.
Answer
Sign in to view the complete answer paper.
Write the control abstraction for LC-Search. Explain how Traveling Salesperson problem is solved using LCBB.
Answer
Sign in to view the complete answer paper.