Sample Questions Daa
Sample Questions Daa
1. Construct a dynamic programming algo to find the length of the longest common
subsequences of two strings.
2. Explain what "asymptotic analysis" is and how it helps in evaluating the efficiency of
algorithms.
3. Solve the recurrence relation 1. T(n)=128T(n/2)+log 3n 2. T(n)=9T(n/3)+n
3. T(n)=T(2n/3)+1 4. T(n)=3T(n/4)+nlogn
2x + 3y - z = 5, 4x + y + 2z = 6, -3x + 2y + 3z = 7n
25. In question different type of graph is given, you can evaluate the performance of
fibonacci heap after applying consolidation process
26. Explain the Fib-Heap Extract min process and apply the process in the given examples.
27. Explain the minimum spanning tree. Explain the BFS and DFS process with proper
example apply BFS and DFS in below example.
28. Explain the travelling salesman problem with approximation and Dynamic programming.
Find the TSP tour of the given garph.
29. Draw BSTs of height 2, 3 and 4 on the set of keys { 10, 4, 5, 16, 1, 17, 21}.
30. Draw all legal B-Trees of minimum degree 2 that represent { 10, 12, 13, 14, 15}.
31. Let X be a no-full internal node of a B-Tree. Let be an index such that Y = Ci[X] is
a full child of X. Write a procedure that splits Y such that X has an additional child
now.
32. Define Fibonacci Heap. Discuss the structure of a Fibonacci Heap with the help of
a diagram. Write a function for uniting two Fibonacci Heaps.
33. Describe the properties of binomial tree. Construct the binomial heap for the
following sequence of numbers 7,2,4,17,1,11,6,8,15,10,20. Also apply the
operation of extracting the minimum key in the resulting binomial heap.
34. Solve the following recurrences using suitable methods:
i. T(n)=5T(n/2 +16) +n2
ii. T(n) = T(√n) +n
1
iii. 𝑇 (𝑛) = 3𝑇(𝑛 ⁄3 ) + 𝑙𝑜𝑔3 n
𝑛 𝑛
iv 𝑇 (𝑛) = 𝑇 ( ) + 𝑇 ( ) + 𝑛2
4 2
v. T(n) = 2T(n/2) +n2
35. Explain in detail about Prims’s algorithm with example and analyze its efficiency.
36. Define knapsack problem. Find the optimal solution to the knapsack instance n=5.
W={20, 30, 40, 10, 7}, p={7, 8, 9, 1,6} and C=80 using greedy method.
37. Why Dijkartra and Bellmen ford algorithm are differing from each other? Even both
are single-source SP.
38. Find the shortest path using Dijkatra algorithm, Explain properly
39. Apply Bellman Ford algorithm and find the result in all iteration
40. Use Prim.s and Kruskal Algorithm to find the minimum spanning tree of the following
41. Explain Floyd Warshell all pair shortest path method and construct the all pair shortest
path of the given graph using above method.
42. Define knapsack problem. Find the optimal solution to the knapsack instance n=5.
W={20, 30, 40, 10, 7}, p={7, 8, 9, 1,6} and C=80 using greedy method.
43. What is 0/1 knapsack problem? Solve the following instance using Greedy
approach, also write the algorithm Knapsack Capacity = 10, P=<1, 6, 18, 22, 28>
and w=<1, 2, 5, 6, 7>
44. For N=4, write all the valid solutions (row-column placements) where 4 queens can be
placed on a 4x4 chessboard without threatening each other. Visualize one solution as a
chessboard.
45. What are the constraints in the N-Queens Problem, and how do they ensure that no
two queens threaten each other on the chessboard?
46. Explain how backtracking is used to solve the N-Queens Problem. What are the key
steps involved in the algorithm?
47. Describe the structure of a Fibonacci Heap and explain the role of the following
components:
Root list
Marked nodes
Child pointers
How do these contribute to its efficiency?
A1: 2×4
A2: 4×5
A3: 5×6
A4: 6×3
A5: 3×2
Determine the optimal order of multiplication to minimize the total number of scalar
multiplications using the Dynamic Programming Approach.
49. Discuss the Longest Common Subsequence (LCS) problem. Generate one LCS for
the given two strings using Dynamic Programming.
X=agbcba
Y=abcbga
Find one Longest Common Subsequence (LCS) using the Dynamic Programming approach.