JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech III ALGORITHM DESIGN AND ANALYSIS Previous Question Paper (August - 2022 - R18)
Answer any five questions
All questions carry equal marks
Main
Write a detailed note on Performance Analysis of Algorithms.
Answer
Performance analysis is the process of determining the resources required by an algorithm to complete its execution. It primarily focuses on two metrics: Space Complexity and Time Complexity.
Space complexity represents the amount of memory an algorithm needs to run to completion. It consists of a fixed part (constant space for variables, constants, and instructions) and a variable part (dynamic memory allocation, recursion stack space). It is expressed as S(P) = C + S_p(n).
Time complexity represents the amount of computer time required by an algorithm to run to completion. It is analyzed by counting the frequency of operations, specifically the basic operations that dominate the execution time. It is expressed as T(P) = C + T_p(n). Performance analysis is typically evaluated using asymptotic notations like Big O, Omega, and Theta to describe the growth rate of resource consumption as the input size n increases.
Explain the implementation of Quick Sort with an example.
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 selecting a pivot, reordering the array so that elements smaller than the pivot are on the left and larger are on the right, and recursively sorting the sub-arrays.
Steps for implementation:
- Choose an element as the pivot (e.g., the last element).
- Partition the array: maintain two pointers, i and j, to swap elements such that all elements less than the pivot move to the left side.
- Place the pivot in its correct sorted position.
- Recursively apply the same logic to the left and right sub-arrays.
Example: Consider the array [24, 9, 29, 14, 19].
- Select 19 as the pivot.
- Partitioning: Compare 24, 9, 29, 14 with 19. After swapping, the array becomes [14, 9, 19, 29, 24].
- 19 is now in its sorted position.
- Recursively sort [14, 9] and [29, 24].
- Result: [9, 14, 19, 24, 29].
The average time complexity is O(n log n), while the worst-case complexity is O(n^2) when the pivot selection is poor (e.g., already sorted array).
What is Divide and Conquer Technique? Explain its Applications.
Answer
Sign in to view the complete answer paper.
Explain the implementation of Binary Search with an example.
Answer
Sign in to view the complete answer paper.
What is n-queens problem? Explain in detail how it is solved using Backtracking technique?
Answer
Sign in to view the complete answer paper.
List out the applications of Backtracking techniques.
Answer
Sign in to view the complete answer paper.
Explain how sum of subsets problem is solved using Backtracking.
Answer
Sign in to view the complete answer paper.
List out the applications of Dynamic Programming.
Answer
Sign in to view the complete answer paper.
Explain in detail optimal binary search trees.
Answer
Sign in to view the complete answer paper.
Explain with an example how all pairs shortest path problem is solved using Dynamic Programming.
Answer
Sign in to view the complete answer paper.
Write a short note on Job sequencing with deadlines.
Answer
Sign in to view the complete answer paper.
Explain in detail how knapsack problem is solved using Greedy Technique?
Answer
Sign in to view the complete answer paper.
Write a brief note on LC Branch and Bound.
Answer
Sign in to view the complete answer paper.
Explain in detail about non deterministic algorithms.
Answer
Sign in to view the complete answer paper.
Discuss about Cook’s theorem.
Answer
Sign in to view the complete answer paper.