0% found this document useful (0 votes)
21 views5 pages

Question Bank DAA Module III & IV

Data structure analysis question Bank

Uploaded by

minaketann3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views5 pages

Question Bank DAA Module III & IV

Data structure analysis question Bank

Uploaded by

minaketann3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Question Bank of Module II, III & IV

1. Consider the chain matrices are given below


A2x6 X B6x4 X C4x1
Find out multiplication sequence whose cost will be minimum.
2. Find an optimal parenthesization of a matrix-chain product whose sequence of dimensions is
<5,10,3,12,5,50,6>.
3. Give an efficient algorithm PRINT-OPTIMAL-PARENS to print the optimal parenthesization of a
MATRIX-CHAIN-ORDER. Analyze your algorithm.
4. Which is more efficient way to determine the optimal number of multiplications in a chain-matrix
multiplication problem: enumerating all the ways of parenthesizing the product and computing the number
of multiplications for each, or running RECURSIVE-MATRIX-CHAIN? Justify your answer.
5. Given a matrix chain with dimensions A(2x4), B(4x3), C(3x5), D(5x1), E(1x6), and F(6x2), apply the
matrix chain multiplication algorithm to determine the optimal order of multiplication and provide the
resulting matrix chain.

6. Differentiate between Greedy strategy and dynamic programming method

7. Explain matrix chain multiplication through example.

8. Given two sequences: "AGGTAC" and "GTACGG." Apply the dynamic programming algorithm for LCS
and provide the LCS length and the LCS itself.

9. Find out longest common subsequence for following string

String1: b q d r c v e f g h

String2: a b c v d e f g h

10. Consider the sequences: "ABCDEF" and "XBCDXYZEF." Using the dynamic programming approach,
compute the LCS length and provide the LCS for the given sequences.

11. Implement algorithm or Pseudocode of Longest common subsequence.

12. Determine an LCS of <1,0,0,1,0,1,0,1> and <0,1,0,1,1,0,1,1,0>.


13. Find out maximum profit by processing the below jobs in JSP
Jobs J1 J2 J3 J4
Deadlines 2 1 2 1
Profit 100 10 15 27

14. Prove that the fractional knapsack problem has the greedy-choice property.
15. : Find the maximum profit by placing below objects into the knapsack size 20.
Objects O1 O2 O3
Weight 18 15 10
Profit 25 24 15

16. Write pseudocode or algorithm for fractional Knapsack problem.

17. Calculate the total no. of bits required to store the following data set using Huffman encoding and each
letter required 3 bits for their representation
letter A B C D E
frequenc 20 2 10 5 12
y

18. What is an optimal Huffman code for the following set of frequencies, based on the first 8 Fibonacci
numbers?
a:1 b:1 c:2 d:3 e:5 f:8 g:13 h:21
Can you generalize your answer to find the optimal code when the frequencies are the first n Fibonacci
numbers?

19. Prove that for an optimal code, if the characters are ordered so that their frequencies are nonincreasing,
then their codeword lengths are nondecreasing.
20. What is the running time of BFS if its input graph is represented by an adjacency matrix and the algorithm
is modified to handle this form of input?
21. Show that in an undirected graph, classifying an edge (u, v) as a tree edge or a back edge according to
whether (u, v) or (v, u) is encountered first during the depth-first search is equivalent to classifying it
according to the priority of types in the classification scheme.
22. Explain the concept of level order traversal and how it relates to Breadth-First Search (BFS).

23. Describe how the visited status of vertices is typically maintained in the BFS algorithm.

24. Compare and contrast Breadth-First Search (BFS) and Depth-First Search (DFS) algorithms.

25. Write the data structure name(s) through which BFS and DFS graph traversal property will be
implemented.

26. DFS of an undirected graph with three vertices P, Q, R is as follows


Discovery time: d[P]=5, d[Q]=6, d[R]14 and Finishing time: f[P]=12, f[Q]=10, f[R]=18
Find out which vertices are connected.
27. Discuss the time complexity of BFS on a graph with V vertices and E edges, and provide a brief
explanation.

28. Discuss the applications of Breadth-First Search (BFS) in real-world scenarios.

29. : Find a valid BFS sequence of node for following graph and consider node N as root node.

30. Describe the concept of backtracking in the context of Depth-First Search (DFS).

31. Find a valid DFS sequence of node for following graph and consider node 0 as root node.
32. Discuss the time complexity of DFS on a graph with V vertices and E edges, and provide a brief
explanation.

33. . Find out Time complexity of

i.Breadth First Search (BFS)

ii. Depth First Search (DFS)

34. Discuss the significance of using a stack data structure in implementing DFS.

35. Let (u, v) be a minimum-weight edge in a graph G. Show that (u, v) belongs to some minimum spanning
tree of G.
36. Show that if an edge (u, v) is contained in some minimum spanning tree, then it is a light edge crossing
some cut of the graph.
37. (i)Write the properties of spanning tree.
(ii)For any complete graph G (V, E) has 4 No. of vertices then calculate total No. of Possible spanning
tree(s).

38. Kruskal’s algorithm can return different spanning trees for the same input graph G, depending on how ties
are broken when the edges are sorted into order. Show that for each minimum spanning tree T of G, there is
a way to sort the edges of G in Kruskal’s algorithm so that the algorithm returns T.

39. Consider the following graph and find out correct edge sequence of Prim’s algorithm.

40. Given the following weighted graph, illustrate the Minimum Spanning Tree (MST) using Prim's algorithm
41. For the following weighted graph, show the Minimum Spanning Tree (MST) using Kruskal's algorithm:

42. Discuss the conditions under which a graph may have multiple Minimum Spanning Trees (MSTs).

43. Consider the following graph and find out correct edge sequence of Kruskal’s algorithm.

44. Construct a Minimum Spanning Tree for the following graph, using Kruskals’ algorithm starting from
vertex ‘a’

45. Construct a Minimum cost Spanning Tree for following graph, from vertex 4 using Prims’ algorithm
46. Discuss the application of Minimum Spanning Trees (MSTs) in real-world scenarios.

47. Suppose that the graph G = (V, E) is represented as an adjacency matrix. Give a simple implementation of
Prim’s algorithm for this case that runs in O(V2) time.
48. Explain how Dijkstra's algorithm handles negative edge weights and discuss its limitations in such
scenarios.

49. In what order do the nodes get included if we run, Dijkstra Single Source Shortest path on the above graph
on vertex ‘a’.

50. Consider the following weighted graph:

Apply Dijkstra's algorithm to find the shortest path from Node 0 to Node 7 and provide the shortest path length.

51. Suppose we change line 4 of Dijkstra’s algorithm to the following.


4 while |Q| > 1
This change causes the while loop to execute |V| – 1 times instead of |V| times. Is this proposed algorithm
correct?

You might also like