0% found this document useful (0 votes)
25 views3 pages

Thapar Institute of Engineering and Technology, Patiala: Any, Suitably

The document outlines the end semester examination for the Design and Analysis of Algorithms course at Thapar Institute of Engineering and Technology, detailing the exam structure, questions, and topics covered. It includes questions on the Ford Fulkerson Algorithm, approximation algorithms for the traveling-salesman problem, dynamic programming for optimal binary search trees, exam scheduling algorithms, and the Boyer Moore string matching algorithm. Additionally, it features a sessional quiz with multiple-choice questions related to algorithm complexities and properties.

Uploaded by

amishra60be23
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)
25 views3 pages

Thapar Institute of Engineering and Technology, Patiala: Any, Suitably

The document outlines the end semester examination for the Design and Analysis of Algorithms course at Thapar Institute of Engineering and Technology, detailing the exam structure, questions, and topics covered. It includes questions on the Ford Fulkerson Algorithm, approximation algorithms for the traveling-salesman problem, dynamic programming for optimal binary search trees, exam scheduling algorithms, and the Boyer Moore string matching algorithm. Additionally, it features a sessional quiz with multiple-choice questions related to algorithm complexities and properties.

Uploaded by

amishra60be23
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/ 3

Roll Number: Number of Pages: 02

Thapar Institute of Engineering and Technology, Patiala


Department of Computer Science and Engineering
END SEMESTER EXAMINATION
B. E. (Second Year): Sem-II (2021/22) Course Code: UCS415
Course Name: Design and Analysis of Algorithms
June 04, 2022 Saturday, 11:25 0 Hrs - 13:25 Hrs Time: 2 Hours, M. Marks: 35
Name of Faculty: Rajiv Kumar, Maninder Kaur, Shreelekha Pandey, Rajesh Mehta,
Mamta Dabra, Yashwant Singh Patel, Vaibhav Pandey, Shruti Aggarwal

Note: Attempt subparts of a question in sequence at one place. Assume missing data, if
any, suitably.

Q1. Execute Ford Fulkerson Algorithm to find the maximum flow for a graph (Fig. 1). (7)
Show all the intermediate stages of residual graph. What is the minimum cut
corresponding to the obtained maximum flow? If each edge capacity in the graph
(shown in Fig. 1) is increased by a value 1, then what will be the changed
maximum flow?
5

10

10

Fig. 1
Q2. (a) State the differences between the 2-approximation and 3/2-approximation (1)
algorithms for the traveling-salesman problem with the triangle inequality.
(b) Solve the following instance of the knapsack problem using the branch-and- (6)
bound technique. Draw the state-space tree which is generated while using
the branch-and-bound technique.
Item Weight Value
1 6 72
2 7 63 Knapsack Capacity W = 12.
3 5 40
4 4 12

Q3. Apply dynamic programming approach to determine the cost and structure of all (7)
the possible optimal binary search trees for a set of n = 3 keys with the following
probabilities:
0 1 2 3
p, 4/17 1/17 4/17
q, 3/17 1/17 1/17 3/17

1/2
Q4. Instructor wants to schedule some final exams for CS courses with the following (7)
course numbers: C101, C112, C213, C224, C315, C326, C417, C428, and C439.
Suppose that there is no student in common taking the following pairs of courses:

C101 - C315, C101 - C326, C101 - C428, C101 - C439


C112 - C213, C112 - C224, C112 - C315, C112 - C326, C112 - C417, C112 - C428
C213 - C112, C213 - C315, C213 - C439
C224 - C112, C224 - C315, C224 - C417, C224 - C428
C315 - C101, C315 - C112, C315 - C213, C315 - C224, C315 - C428
C326 - C101, C326 - C112
C417 - C112, C417 - C224, C417 - C428, C417 - C439
C428 - C101, C428 - C112, C428 - C224, C428 - C315, C428 - C417, C428 - C439
C439 - C101, C439 - C213, C439 - C417, C439 - C428

How many minimum exam slots are necessary to schedule exams? Give
appropriate algorithm and show all intermediate steps involved by using that
algorithm.

Q5. Write an efficient algorithm or pseudocode to compute the shift value using good (7)
suffix shift rule in the Boyer Moore string matching algorithm. It should include
the required pre-processing logic along with the update in the shift value. Explain
the proposed algorithm or pseudocode for the pattern "CTTACTTAC".

Note: The proposed algorithm or pseudocode can only take the pattern as an
input argument. If needed then length of the pattern can also be considered as an
input argument.

ALL THE BEST

2/2
Roll No. Name: Group:

TIET Patiaia
Department of Computer Science & Engineering
UCS415: Design and Analysis of Algorithms

Sessional Quiz - 04 June, 2022 @ 11:15 AM


,me. 10 Minutes Maximum arks.' 10

/Vote: All answers must be written within the space provided for each question. Overwritten
answers vvill not be evaluated. Use only capital alphabets (A/B/C/D) to record your responses.

Write the correct answers here:


Q1 Q2 Q3 Q4 Q5 Q6 Q7
1 mark 1 mark 1 mark 1 mark 2 mark 2 mark 2 mark

Ql • The time complexity to determine an augmenting path in Ford-Fulkerson algorithm is


A. 0(1E1) B. 0(1E1 log 1V1) C. 0(1E12) D. 0(1E12 log 'VD
Q2. What is the worst-case time complexity for finding all m-colorings of a graph with n vertices
using backtracking?
A. 0(n) B. 0(m.) C. 0(nxm) D. 0(nxinn )
Q3. The total number of nodes in the 4-queens state space tree is
A. 63 B. 65 C. 64 D. 66
Q4. Which of the following is not true regarding the number of binary search trees with n nodes?
A. It is equal to the number of ways of multiplying (n+1) matrices.
B. It is equal to the number of rooted binary trees with n nodes.
1 2n
C. It is equal to — ( ).
n+1 n
D. It is equal to n!.

Q5. Which one of the following does not provide an optimal solution for 8-queens problem?
A. 5,3,8,4,7,1,6,2 B. 4,1,5,8,6,3,7,2 C. 1,6,3,8,3,2,4,7 D. 6,2,7,1,4,8,5,3
Q6. For the given instance of 0/1 knapsack problem: Weight = [4,7,5,3], Value = [40,42,25,12] and
Knapsack Capacity = 10, what would be the upper bound cost at the root of state space tree?

Q7. The search cost for the binary search tree shown here with the
following successful and unsuccessful search probabilities is

0 1 2 3 4
pi 3 3 1 1
qi 2 3 1 1 1

You might also like