DAA - Questions BANK
DAA - Questions BANK
17. In the given graph, find the minimum spanning tree using kruskal algorithm.
15marks questions
1. Write an algorithm of Merge sort and find out its average time complexity.
31.12. What willbe the running time of Quicksort in the following situation?
i. Elements of array A have same value.
ii. Elements of array A are already sorted.
iii. Each time the pivot element is placed at the middle of the array or sub-array.
iv. The array is partitioned in 9:1 ratio
12. What is the running time of BFS if we represent its input graph by an adjacency matrix
and modify the algorithm to handle this form of input?
13.Breadth First Search (BFS) is started on a binary tree beginning from the root vertex.
There is a vertex t at a distance four from the root. If t is the n-th vertex in this BFS traversal,
then what will be the maximum possible value of n?
14.Prove that A directed graph G is acyclic if and only if a depth-first search of G yields no
back edges.
15. Give an algorithm that determines whether or not a given undirected graph G=(V, E)
contains a cycle. Your algorithm should run in O(V) time, independent of |E|
16. Explain topological sort with algorithm and example.
17. Explain strongly connected components with algorithm and example.
18. Describe dijkstra algorithm and explain the complexity.
19. In the given graph, find the shortest path from v1 to v8 and v7 using dijkstra algorithm.
20. Find the maximum flow from the following graph between s and t.
21. Prove that 3 coloring problem is a NPC problem.
22. Define vertex cover problem. Write a nondeterministic algorithm of VCP.
23. Define clique decision problem. Write a nondeterministic algorithm of CDP.
24. Define independent set problem. Write a nondeterministic algorithm of ISP.
25. Prove that 3SAT is NPC. Prove that VCP is NPC.
26. Prove that ISP is NPC. Prove that CDP is NPC.
27. If P!=NP then prove that NPC ⋂ P=ф
29. A)“ The problem of determining whether there exists a cycle in an undirected graph is
in NP.”-justify the statement.
B)Let S be an NP-complete problem and Q and R be two other problems not known to be
in NP. Q is polynomial time reducible to S and S is polynomial-time reducible to R.then
what will be Q and R?
C) Consider two decision problems Q1,Q2 such that Q2 reduces in polynomial time to 3-
SAT and 3-SAT reduces in polynomial time to Q1.Then what will be the class of Q1 and
Q2