0% found this document useful (0 votes)
54 views2 pages

BCSE204L FAT Model Question

The document outlines a final assessment test for a B.Tech. course on Design and Analysis of Algorithms, detailing the structure, instructions, and rubrics for evaluating answers. It includes eight model questions that require students to design algorithms, analyze their complexity, and provide pseudocode for various problems related to intervals, polygons, subsets, strings, and graphs. The test is designed to assess both the design and analysis components of algorithm development.

Uploaded by

sri
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)
54 views2 pages

BCSE204L FAT Model Question

The document outlines a final assessment test for a B.Tech. course on Design and Analysis of Algorithms, detailing the structure, instructions, and rubrics for evaluating answers. It includes eight model questions that require students to design algorithms, analyze their complexity, and provide pseudocode for various problems related to intervals, polygons, subsets, strings, and graphs. The test is designed to assess both the design and analysis components of algorithm development.

Uploaded by

sri
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/ 2

Final Assessment Test - Model Questions

Programme B.Tech.(CSE) Semester XX


Course Design and Analysis of Algorithms Code BCSE 204L
Faculty YY Slot/Class No. Z/CH123456789
Time 180 Minutes Max. Marks 100

Instructions:

ˆ Answer all the EIGHT questions.


ˆ If any assumptions are required, assume the same and mention those assumptions in the answer script.
ˆ Use of intelligence is highly appreciated.
ˆ Your answer for all the questions should have both the ’design’ component and the ’analysis component’
ˆ The ’Design’ component should consist: logic to develop the pseudocode, illustration, pseudocode.
ˆ The ’Analysis’ component should consist: Computation of T(n), Time-complexity.
ˆ Rubrics for question No. 1,2 : Logic(2 marks), Illustration (3 marks), Pseudocode (3 marks), Running
time & Time-complexity (2 marks)
ˆ Rubrics for question No.3(a), 3(b): Identification of class-complexity (2 marks ), Justification ( 3 marks
)
ˆ Rubrics for question No. 5,6,7: Logic(3 marks), Illustration (5 marks), Pseudocode (5 marks), Running
time & Time-complexity (2 marks)
ˆ Rubrics for question No. 8 : Logic for A and B (4 marks), Illustration for A and B (4 marks), Pseu-
docodes : A and B (4 marks), Running time & Time-complexity of A and B (3 marks)

1. The set of all real numbers that lie between an integer a and an integer b ( a and b are also included in
the set), a < b, is represented as [a, b] and is called as interval a,b. Given [a1 , b1 ], [a2 , b2 ], ...[an , bn ], design
a greedy pseudocode to identify the maximum number of intervals (among the given n intervals ) such
that the intersection of any two intervals (among the intervals identified by you ) is always empty. Your
design component should contain all the required steps. Analyse the algorithm with all the required
steps. [10 marks]

2. Consider the 2-dimensional plane where the points are represented by a pair of integers. A line with
the end-points pi and pj is represented as l(pi , pj ). A polygon P = {p1 , p2 , ..., pm } is a set of points that
form a closed figure with the edges p1 − p2 , p2 − p3 , p3 − p4 , ..., p(m−1) − pm , pm − p1 . Edges of the polygon
can also be called as the line connecting the points. For example, the edge p1 − p2 can be called as a
line l whose end-points are p1 and p2 . A polygon is said to be a simple polygon if none of its edges
cross itself. Given a polygon P = {p1 , p2 , ..., pm }, design a pseudocode to decide whether the polygon is
a simple polygon or not. [10 marks]

3. (a) Consider the problem P : Given a positive integer N , task is to check whether the sum of the
factors of N except N equals N or not. For example, factors of 6 (other than 6) are 1,2,3. So, sum
of the factors of 6 (other than 6) is equal to 6. Identify the complexity-class (P/NP/NPC) of the
problem Q with justification. [5 marks]
(b) Consider the problem P1 : Given a set S of positive integers, does there exist two disjoint subsets
S1 , S2 of S such that the sum of the integers in S1 equals the sum of the intgers of S2 . For the input
S = {3, 4, 2, , 5}, the solution to the problem is ‘yes’ since there exist two subsets S1 = {3, 4}, S2 =
{2, 5} such that the sum of the elements of S1 equals the sum of the elements of S2 . Identify the
complexity-class (P/NP/NPC) of the problem P1 with justification. [5 marks]
4. Understand the Algorithm and answer the following questions .

ˆ f2(B):
– q = B mod 10
– If (q mod 2) == 0 then return B
– return B
– else return 0
ˆ f1(A, l, h)
– if l==h then return f2(A[l])
– m = (l+h)/2
– return f1(A, l, m) + f1(A, m+1, h)
ˆ Algorithm XXXX(A)
– n = A.length
– f1(A,1,n)

(a) Compute the output of the Algorithm when [123, 45, 52, 61] is given as an input. [2 marks]
(b) Describe the functionality of the Algorithm [2 marks]
(c) Is it possible to remove any lines in functions f1 or f2 such that the functionality of the algorithm
does not change. If so, identify the lines. [2 marks]
(d) Compute the time complexity of the algorithm [2 marks]
(e) If the algorithm returns zero for an input array L, comment on the elements of L? [2 marks]

5. A common subsequence Z of two strings X and Y is said to be a ‘Distinct Common Subsequence


(DCS)’ X & Y if Z has no symbols repeated in it. If X = ABCDEF , Y = BADEAF , then ADEF
is a DCS of X and Y . EF is also another DCS of X & Y . Given two strings X of length n and Y
of length m, Design a pseudocode to compute all the distinct common subsequences of X and Y , of
length greater than ⌊ m+n
2 ⌋. Here, ⌊.⌋ is the usual floor function. If there are no DCS possible with
the sepcified length, your pseudocode should return −1. Your design component should contain all the
required steps. Analyse the algorithm with all the required steps. [15 marks]

6. Consider a grid of size m × n, with m rows and n columns. Every cell is referred with a pair [i, j] which
conveys that the cell is at the intersection of the ith row and the j th column. You have to fill the cells
of the grid with the numbers from the set A = {1, 2, ...9}. Given an m × n grid, design a pseudocode to
fill the cells with the elements of A such that no row contains more than two even numbers, no column
contains more than two odd numbers and the diagonal contains no two same numbers. Your pseudocode
should return m × n array, R such that R[i, j] = x if the cell [i, j] contains the number x. [15 marks]

7. Given a graph G = (V, E, s, c, t), where V is the set of vertices, E is the set of edges, s ∈ V is a vertex
designated as a source vertex, c is the set of capacities of all the edges of G, t is a vertex designated
as the target vertex. Let |f | denote the maximum flow of the network G with s as the source vertex
and t as the target vertex. Given the graph G = (V, E, s, c, t), design a pseudocode to identify the
edges (u, v) for which [c[(u, v)] − f [(u, v)]] ̸= 0, when the flow across the network is |f |. For the purpose
of the illustration, you have to take a graph with a minimum of six vertices and a minimum of eight
edges. Your design component should contain all the required steps. Analyze the pseudocode with all
the required steps. [15 marks]

8. A string is said to be symmetrical if both halves of the string are the same. For example strings aa, abab,
abaaba are a symmetrical string of length 2,4, and 6 respectively. Given a string S, develop an algorithm
to determine the longest symmetrical substring of S. For example, given a string S1 = aababaacabacab,
the longest symmetrical substring is acabacab which starts at index 7. [15 marks]

⇐⇒ ⇐⇒ ⇐⇒

You might also like