ALL PYQ
ALL PYQ
i) Explain what is a i) tree edge ii) back edge and ii) cross edge in Depth First Search.
) Prove that in aDepth First Search (DFS) of an undirected graph G, every edge is either atree cdge or
a back edge.
Explain what is meant by 'a cut respects a set A'. State the Kruskal's algorithm for finding the
Minimum Spanning Tree (MST) in agiven connected and undirected graph.
5) Explain the time complexity of the Prim's algorithm for finding the MST. [5]
4. a) Explain why the Dijkstra's algorithm to find the single source shortest path does not work when the
edges may have negative weights. [S]
Prove that the maximum degree of any node in an n-node binomial tree is log n. Prove that a
binomial heap H contains at most Llog n +1 Jbinomial trees.
6. a) In Delete Min operation on the Fibonacci Heap, a consolidate tree function is executed to ensure that
no two roots have same rank. Explain the consolidate tree operation.
b) What are the properties of a Red-Black tree? Explain.
.. a) Explain what is meant by "Y is polynomial-time reducible to X(Y Sp X)y". Prove that Independent
Set Problem Sp Vertex Cover Problem.
b) Give the statement for 3 Satisfiability Problem (3-SAT). Show that 3-SAT S, Independent Set
Problem. (S]
7. a) Prove that if ZspY and Y SpX, then Z Sp X. What do you understand by efficient certification?(5]
b) Show that Directed-Hamilton-Cycle Sp Hamilton-Cycle-Problem. [S]
Indian Institute of Engineering Science and Technology, Shibpur
B. Tech. Information Technology, 5th Semester End Semester Examinations, December 2021
Algorithms (IT-3104)
Full Marks: 50 Answer any five questions Time: 1 Hour 30 Minutes
1. a) Why does not Dijkstra algorithm for single-source shortest path work with negative weights? Can
you explain with an example? [5]
b) Suppose 𝐻1 𝑎𝑛𝑑 𝐻2 are two Fibonacci Trees. The root list of 𝐻1 contains 8 nodes and that of 𝐻2
contains 3 nodes. How will you unite these Fibonacci heaps? Explain each operation i.e., comparison,
assignment etc. for this process.
Explain with an example how will you insert a node in a Fibonacci Tree. [5]
2. a) Under what condition in decrease key operation of Fibonacci Tree, there will be modification of only
one node? How will you combine three Fibonacci Heaps 𝐻1 , 𝐻2 , 𝑎𝑛𝑑 𝐻3 and how many pointers have
to be modified for this process? [5]
b) Differentiate between a Binary Search Tree and a Red-Black Tree. Describe any two properties of a
Red-Black tree. [5]
3. a) What is the black height of a node? What is the black-height of a Red-Black tree? Given the same
height of two Red-Black trees, 𝐻1 𝑎𝑛𝑑 𝐻2, can their black-heights be different? Explain. [5]
b) What can be the maximum height of a Red-Black tree with n internal nodes? Prove it. [5]
4. a) What do you understand by the branching factor of a B-Tree? Does it necessarily mean that a large
branching factor will lead to reduced height of a B-Tree? Why the root node of a B-Tree should be kept
permanently in the main memory? [5]
b) Insert 12 in the following B-Tree.
5. a) What is an independent set? Let V= (G, E) be a graph, then S is an independent set if and only if its
complement V-S is a vertex cover – prove it. [5]
b) Prove that Vertex Cover ≤𝑃 Independent Set. [5]
6. a) What do you understand by Y is polynomial time reducible to X? Why such reducibility is important
in the context of intractability of problems? [5]
b) Prove that Independent Set ≤𝑃 Set Packing problem. [5]
7. a) What is a Euler tour? What is Hamiltonian Cycle? Can you relate between the two? [5]
b) What are the properties of an efficient certifier? Explain what can be an efficient certifier for a set
cover problem? [5]
8. a) What is the randomized quicksort algorithm? Compare quicksort, heapsort, and mergesort with
respect to locality of reference. [5]
b) Define a binary heap. Explain with an example. What is a complete binary tree? [5]
Indian Institute of Engineering Science and Technology, Shibpur
B. Tech. Information Technology, 5th Semester Mid Semester Examinations, October 2021
Algorithms
IT-3104
1. a) 3-D Maxima problem: Let a point p in 3-dimensional space be given by its integer coordinates, p
= (p.x, p.y,p.z). A point p is said to be dominated by a point q if p.x<= q.x and p.y<=q.y and
p.z<=q.z. Given a set of n points, P = {p1, p2, … , pn} in 3-space a point is said to be maximal if it is
not dominated by any other point in P. Write an algorithm to find the set of maximal points. [3]
b) Find the time complexity of the algorithm given by you for the 3-D maxima problem. [3]
2. a) Let f and g be two functions that take nonnegative values, suppose that f=O(g). Show that
g=(f). [3]
b) Suppose that f and g are two functions such that for some other function h, we have f = O(h) and
g = O(h). Then f + g = O(h). [3]
3. a) “T(n)=pn2+qn+r is both O(n2) and (n2)” – comment and explain whether this statement is
correct. [3]
b) If f= (g) and g=(h), then f=(h). Prove it. [3]
5. a) State the Master Theorem for determining the asymptotic growth rates of recurrence problems.
[3]
6. a) If G is an directed graph, the sum of the lengths of all the adjacency lists is |E|. Prove it. [3]
b) Breadth-first search colors each vertex white, gray, or black. All vertices start out white and may
later become gray and then black. Show with an example when i) a white vertex becomes black and
ii) a white vertex becomes gray then black. [3]
7. a) In Depth-First-Search, what do you understand by the following? i) Back edge ii) forward edge
iii) cross edge. Explain with illustrations. [3]
b) Why the Minimum Spanning Tree of a graph may not be unique? Explain with example. [3]