JNTU
JNTU B.Tech III DESIGN AND ANALYSIS OF ALGORITHMS Previous Question Paper (August - 2022 - R16)
Answer any five questions. All questions carry equal marks.
Main
Explain about the types of Randomized algorithm.
Answer
Randomized algorithms utilize a source of random bits to guide their execution, ensuring that the algorithm's behavior depends on both the input and the random choices made. They are primarily classified into two types:
- Las Vegas Algorithms: These algorithms always produce the correct result or inform the user about a failure. The randomness affects only the running time, not the correctness of the output. An example is Randomized QuickSort, where the choice of the pivot is random, but the sorted output is always correct.
- Monte Carlo Algorithms: These algorithms have a deterministic running time but a probability of producing an incorrect answer. The error probability can be reduced by running the algorithm multiple times or increasing the computational effort. An example is the Miller-Rabin primality test, which determines if a number is prime with a certain probability of error.
Write an algorithm of Quick sort and analyze performance of quick sort in worst case.
Answer
The QuickSort algorithm follows 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 are on the right.
Algorithm:
QuickSort(A, low, high) {
if (low < high) {
p = Partition(A, low, high)
QuickSort(A, low, p - 1)
QuickSort(A, p + 1, high)
}
}In the worst-case scenario, the partition process consistently results in highly unbalanced splits, such as when the pivot is always the smallest or largest element in the array (e.g., sorting an already sorted array with the first or last element as the pivot). This leads to a recursion tree of depth n, where n is the number of elements.
The recurrence relation for the worst case is:
This simplifies to:
Summing this series results in T(n) = Θ(n²). Thus, the worst-case time complexity of QuickSort is quadratic.
What are asymptotic notations? Explain with examples.
Answer
Sign in to view the complete answer paper.
Sort the following elements using Merge sort: 12, 2, 16, 30, 8, 28, 4, 10, 20, 6, 18
Answer
Sign in to view the complete answer paper.
Explain the Union algorithm with weighing rule.
Answer
Sign in to view the complete answer paper.
Discuss about the general method of backtracking.
Answer
Sign in to view the complete answer paper.
Write an algorithm to determine Bi-connected components.
Answer
Sign in to view the complete answer paper.
Describe sum of subsets problem with an example.
Answer
Sign in to view the complete answer paper.
Show how Prim’s algorithm can be implemented using heap. What would be the time complexity of the algorithm?
Answer
Sign in to view the complete answer paper.
Write the applications of Greedy method.
Answer
Sign in to view the complete answer paper.
Write the Greedy algorithm for sequencing unit time jobs with deadlines and profits. Trace the algorithm with suitable example.
Answer
Sign in to view the complete answer paper.
Use the function OBST to compute w(i, j), r(i, j), and c(i, j), 0 ≤ i < j ≤ 4, for the identifier set (a1,a2,a3,a4) = (cout, float, if, while) with p(1) = 1/20, p(2) = 1/5, p(3) = 1/10, p(4) = 1/20, q(0) = 1/5, q(1) = 1/10, q(2) = 1/5, q(3) = 1/20, and q(4) = 1/20. Using the r(i, j)’s construct the optimal binary search tree.
Answer
Sign in to view the complete answer paper.
Discuss about chained matrix multiplication in dynamic programming.
Answer
Sign in to view the complete answer paper.
Explain the following:
LC branch and bound
Answer
Sign in to view the complete answer paper.
Cook’s theorem.
Answer
Sign in to view the complete answer paper.