B.Tech./B.Tech. (Working Professional) IV Semester
Examination, June 2025
Grading System (GS) / Working Professional
Max Marks: 70 | Time: 3 Hours
Note:
i) Attempt any five questions.
ii) All questions carry equal marks.
a) Solve the following recurrence relations using the substitution method.
$$T(n) = \begin{cases} 1 & n \le 4 \\ 2T(\sqrt{n}) + \log n & n > 4 \end{cases}$$ (Unit 1)
b) The worst case time of procedure merge sort is $O(n \log n)$. What is its best case time? Can we say that the time for merge sort is $O(n \log n)$? (Unit 1)
a) Obtain a set of optimal Huffman codes for message (M1, ... M7) with relative frequencies (q1, q2.....,q7) = (4, 5, 7, 8, 10, 12, 20). Draw the decode tree for this set of codes. (Unit 2)
b) Use algorithm shortest paths to obtain in non-decreasing order the lengths of the shortest paths from vertex 1 to all remaining vertices in the di-graph.
(Unit 2)
a) Give an example of a set of knapsack instances for which $|S^i| = 2^i, 0 \le i \le n$. The set should include one instance for each $n$. (Unit 3)
b) Explain Floyd Warshall algorithm with suitable example. (Unit 3)
a) Given an $n \times n$ chessboard, a knight is placed on an arbitrary square with coordinates $(x, y)$. The problem is to determine $n^2-1$ Knight moves such that every square of the board is visited once if such a sequence of moves exists. Present an algorithm to solve this problem. (Unit 4)
b) Consider the traveling salesperson instance defined by the cost matrix.
$$\begin{pmatrix} \infty & 7 & 3 & 12 & 8 \\ 3 & \infty & 6 & 14 & 9 \\ 5 & 8 & \infty & 6 & 18 \\ 9 & 3 & 5 & \infty & 11 \\ 18 & 14 & 9 & 8 & \infty \end{pmatrix}$$ (Unit 4)
a) Show that DFS visits all vertices in G reachable from V. (Unit 5)
b) Obtain a nondeterministic algorithm of complexity $O(n)$ to determine whether there is a subset of $n$ numbers $a_i, 1 \le i \le n$, that sums of $m$. (Unit 5)
a) Write an algorithm to delete an element $x$ from a binary search tree $t$. What is the time complexity of your algorithm? (Unit 5)
b) What do you mean by balance factor in AVL tree? Give a suitable example to balance a AVL tree. (Unit 5)
a) Suppose there are $n$ jobs to be executed but only $k$ processors that can work in parallel. The time required by jobs $i$ to $t_i$, write an algorithm that determines which jobs are to be run on which processors and the order in which they should be run so that the finish time of the last job is minimized. (Unit 4)
b) Find optimal solution for 0/1 knapsack problem (W1, W2, W3, W4) = (10, 15, 6, 9), (P1, P2, P3, P4) = (2, 5, 8, 1) and M = 30. (Unit 3)
Write short notes on following. (any two)
a) B-Trees (Unit 5)
b) Tree Traversal (Unit 5)
c) Reliability Design (Unit 3)