0% found this document useful (0 votes)
0 views

2016-Aut

The document outlines the PhD Qualifier Examination for the Department of Computer Science and Engineering, dated November 3, 2016, with a maximum score of 100 marks. It includes various questions across three groups (A, B, and C) covering topics such as algorithm complexity, data structures, graph theory, and logic circuits. Candidates are required to answer a total of ten questions, five from Group A and five from Groups B and C.

Uploaded by

vimkain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

2016-Aut

The document outlines the PhD Qualifier Examination for the Department of Computer Science and Engineering, dated November 3, 2016, with a maximum score of 100 marks. It includes various questions across three groups (A, B, and C) covering topics such as algorithm complexity, data structures, graph theory, and logic circuits. Candidates are required to answer a total of ten questions, five from Group A and five from Groups B and C.

Uploaded by

vimkain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

PhD Qualifier Examination

Department of Computer Science and Engineering


Date: 03-Nov-2016 Maximum Marks: 100

[Answer any five questions from Group A, and any five questions from Groups Band c.]
Group A

M Write only the answers (no need of any explanation). (2! x4)
(a) In each case, state whether f(n) = O(g(n)), or f(n) = n(g(n)), or both (that is, f(n) = 0(g(n))).
i) f(n) = 510g(n), and g(n) = log(n3).--
ii) f(n) =n2n,andg(n) =3n. I

(b) Given a sorted array A and an interval [a,b], we have to find how many elements of A lie in this
interval. What is the worst-case time complexity of the best known algorithm for this? lA'!']?, -t . Cl' e
(c) Let Sand T be two binary search trees with m and n nodes, respectively. All the elements in S are
distinct. Similarly, all the elements in T are distinct. We have to find the common elements of Sand T.
w

What is the worst-case time complexity of the best known algorithm for this? (!}C-nv t! I
w

(d) Which of the following operations is/are asymptotically more efficient in a height-balanced binary
search tree compared to a binary max heap?
w

i) searching a key element v /


.s

ii) insertion
iii) deletion of maximum element
ol

iv) deletion of minimum element


ut

A.2 You are given an array A [0 ... n - 1] storing exactly n of the n + 1 integers 0,1, ... ,n. This means that
exactly one integer x in the range 0, 1, ... ,n is missing in A. Your task is to determine x.
io

(a) If A is unsorted, propose an O(n )-time O( 1)-space algorithm to find x. (5)


ns

(b) If A is sorted (in ascending order), propose an O(logn )-time O( I )-space algorithm to find x. (5)

~. Consider a rooted tree T with each node storing an integer key. Each node may have an arbitrary number
ad

of children. Let us impose a left-to-right ordering on the children of each node. We then index the nodes
as 0,1,2,3, ... level by level starting from the root, and in each level from left to right (see Figure 1 for
da

an example). We use an array A of integer pairs to store the tree as follows. Consider the node at index i
in the tree. Let k be the key stored at this node, and let the index of the parent of this node be p. Then, the
i-th entry in the array A is the pair (k,p). The index of the parent of the root is -l. Let n be the number
.

of nodes in T. Assume that A is read-only and cannot be modified.


in

(a) Propose an algorithm that, given the array A and its size n, prints the keys stored in all the leaf nodes
of the tree. Your algorithm should run in O(n) time and use 0(1) extra space. (5)
(b) Propose an algorithm that, given A, its size n, and an index i E {O, 1,2, ... ,n - I}, prints the keys
stored in all the child nodes of the node stored at index i. Your algorithm should run in O(t + logn) time
and use O( 1) extra space, where t is the number of children of the node at index i. (5)

A1i You are doing some stress-testing on a particular model of glass jars to determine the height from which
they can be dropped without being broken. The setup for this experiment is as follows. You have k jars
of the particular model, and a ladder with n rungs. You want to find the highest rung from which you can
drop ajar and not have it broken. Call this the highest safe rung. The problem is to determine the highest
safe rung in as few jar-drops as possible. You can reuse a jar as long as it is not broken.
(a) Suppose k = l. Devise a strategy to determine the highest safe rung with at most n jar-drops. (3)
(b) Suppose k = 2. Devise a strategy to determine the highest safe rung with at most f(n) jar-drops,
where f(n) is o(n) (that is, lim f(n) = 0). (7)
n-too n

- Page 1 of 4 -
Figure 1: Example for Question A.3
T

8 10
'""
7 " 1

o I 2 3 4 5 6 7 8 9 10

~[2J~~00[!3J 16 00DJ
A IB~[IJ@][IJ0030l?J0
w

£5 (a) Define a weighted graph, and explain its adjacency-list representation with a suitable example.
w

(1+2)

(b) Let G = (V~E) be a weighted, undirected, connected graph. Each of its edges has weight either 1 or
w

2. What can be the minimum possible weight of a/the Minimum Spanning Tree (MST) of such a graph?
.s

Suggest an efficient algorithm to decide whether the given graph G has an MST with this minimum
possible weight. Explain its worst-case time complexity. Assume that the input graph G is specified by
ol

an adjacency-list representation. _ (1+4+2)

¥ You are given an unsorted


ut

array A = (aa, aI, ... ,an-I) of n integers (positive, negative, or zero). A run in
tJ A is an interval [i, J] of indices (not necessarily maximal) such that a, :::;au. I :::;... :::;
aj_1 :::; ai- Write an
io

efficient C function that, given A and n, computes a run in A with the largest possible sum. Notice that
the sum of an empty run is zero. (10)
ns

~A = (aa,al, ... ,an-I) be an array ofn positive integers. We call A super-increasing if a, > aa +aj +
...+ ai-l for all i = 1,2,3, ... ,n - 1. For example, the array (2,3,6,14,28,60,125) is super-increasing,
ad

whereas the array (2,3,6,11,20,50,100) is not super-increasing.


¥ (a)' Write an efficient C function that, given A and n, determines whether A is super-increasing. (4)
da

y (b) Write an efficient C function that, given a super-increasing array A, its size n; and a positive integer
x, determines whether x can be written as
.in

x = ail +ai2 + ... +aik


for some k ;? 1, and for array indices satisfying °:::; <
i1 i: < ... < ik :::;n - 1. (6)

A.8 Let A = (aa, al, ... ,an-d be a sorted array of n distinct positive integers, B a positive integer, and C =
r-- (ca, Cl, ... ,Cn- d a second array of n positive integers (not sorted, and may contain duplicate entries). A
set (il, i2,···, ik) of indices satisfying °:::;
i1 < ii < ... < ik :::;n - 1 for some k ;? 1 is called feasible if
aij - ai.., ;? B for all J = 2,3, ... ,k. The cost of a feasible set (il' i2,· .. ,ik) of indices is Cil + Ci2+ ... + Cik.
Your task is to maximize the cost over all feasible sets of indices. Call this maximum cost M(n).
(a) Derive a recurrence relation for M (n), that is, express M (n) in terms of M (i) for i = 1,2, ... , n - 1,
where M(i) is the maximum cost for the first i items (A[O ... i-l],B,C[O ... i-l]). Also supply the
required initial condition(s). (Hint: For deriving the recurrence, consider the two cases: ik < n - 1 and
ik = n - 1, where ik is the last index in a feasible set. If ik < n - 1, then all the indices in the feasible set
are chosen from 0, 1,2, ... , n - 2. If h = n - 1, consider the constraint aik - aik_l ;? B.) (4)
(b) Write an efficient C function to compute M(n) using the recurrence of Part (a). (6)

- Page 2 of 4 -
Group B

B.1 Let j: SI -t S2, g: S2 -t S3, and h : SI -,t S3 be functions. Suppose that h = go j, that is, h(x) = g(J(x))
for all x E SI: .
(a) Argue that if his surjective (onto) and j is injective (one-one), then g must be surjective. (5)

(b) If his injective, show that j must be injective. (5)

~2 You are given a bag containing n unbiased coins. You are told that n - 1 of these coins are normal, with
heads on one side and tails on the other, whereas one coin is a fake, with head on both sides. You reach
into the bag, pick out a coin uniformly at random, and toss the coin that you pick out for a total of k times.
(a) What is the probability that you see heads in all the k tosses? (4)
(b) If you see heads in all the k tosses, what is the conditional probability that you picked the fake coin? (6)

B.3 Solve the recurrence relation: a(n) = v x a(njv) + e, where v, e E N, v > 1, and e > O. Assume that n = Jc
for some kEN. (10)

~yProve or disprove the following.


w

(a) If M is an NFA that recognizes language LI, swapping the accept and non-accept states in M yields
w

a new NFA that recognizes LI (the complement of LI). (4)


w

(b) Regular languages are closed under doubling, that is, if the language L is regular, then so also is the
language ~ = {two(x) I x EL}, where string doubling (two) is defined inductively as tWO(E) = E, and
.s

two(ax) = aa- two(x). (6)

V
ol

Provide the following constructions.


(a) A DFA over the alphabet {a, b}, that accepts only those strings which have aababb as a substring. (4)
ut

(b) A CFG for the language L3 = {aibick I j > 2i + k} (6)


io

B.6 (a) Use Pumping Lemma to prove that L4 = {wtyj? I w, t E {O, 1} * and Iwl = It I} is not a regular language. (7)
ns

(b) Consider the following grammar over the alphabet {a, b} and with start symbol S.
S -t SS I ab I a I E
ad

Is the language generated by this grammar regular? Justify. (3)


da

Group C
.in

~ (a) A combinational logic circuit has four inputs Aa,AI ,A2,A3 which represent four bits of an operand
A, and one output Z. The output is 1 iff the input has at least three consecutive O's or at least three
consecutive 1'so For example, if AaA IA2A3 = 1000, then Z = 1, but if AaA IA2A3 = 0100, then Z = O.
Find a minimum product-of-sum expression for Z. (5)

(b) A switching circuit has two control inputs Cl and C2, two data inputs Xl and X2, and one output Z.
The circuit performs one of the logic operations AND, OR, EQU (equivalence) and XOR on the two data
inputs. The output depends on the control inputs as follows.

Cl C2 Z
0 0 Xl OR X2
0 1 Xl XOR X2
1 0 Xl AND X2
1 1 Xl EQU X2

Find an expression for Z. (5)

- Page 3 of 4 -
Ct3--{a) Convert a D flip-flop to a JK flip-flop (do not touch the clock input). Draw the circuit diagram. (5)
(b) A binary ripple counter counts up from 0 to 16,383 (and then back to 0). How many flip-flops are
required to design the counter? If the clock frequency is 8,192 MHz, what is the frequency at the output
of the last stage? (2!+2!)

C.3 We say that from bit position i, a transfer of carry occurs if a carry is generated or propagated. For
binary adders, the auxiliary transfer signal t, = gi V Pi is derived by an OR gate, that is, t, = gi V Pi =
x.y, + (Xi EB Yi) = Xi VYi. The logic behind the change is that an OR gate is often faster than an XOR gate,
so ti can be produced faster than Pi.
Answer the following questions with respect to this modified adder.
(a) Comment on the correctness of the modified adder by showing the validity of the carry recurrence,
when Pi is replaced by t.. (5)
(b) Draw the complete architecture of a 4-bit adder using this modification. Comment on the impact on
area and time because of the above change. (5)

C.4 Matrix transposition is an important operation in many signal-processing and scientific computations.
Consider transposing a 4 x 4 matrix A, stored in row-major order starting at address 0, and placing the
result in B, stored in row-major order beginning at address 16. We use two nested loops (indices i and i),
w

copying Ai,} into B},i within the inner loop}. Assume word-addressed cache and main memory units.
w

Note that each matrix element is accessed exactly once. Draw two 4 x 4 tables representing the matrix
elements, and place H for hit and M for miss in each entry for the following cache organizations of an
w

8-word cache.
.s

(a) Direct-mapped, 2-word lines (5)


(b) Two-way set-associative, l-word lines, LRU replacement policy (5)
ol

C.S (a) Define a semaphore. (3)


ut

(b) Consider two processes P and Q. P prints all odd integers from 1 to 100, and Q prints all even integers
io

from 1 and 100. Write pseudocodes of P and Q using semaphores such that when the two processes are
run, all integers from 1 and 100 are printed consecutively. (5)
ns

(c) Name four information about a process that are typically kept in the PCB of a process. Your answer
should contain all of the following: basic information, scheduling-related, and memory-related informa-
ad

tion of a process. (2)

C.6 (a) Consider a demand-paged memory-management system with 8KB page size, 32-bit address space,
da

and 16GB RAM. The page table stores 4 extra bits per entry, in addition to the page-frame information.
What is the size of the page table if the memory is aligned at byte boundaries? Show all calculations. (5)
.in

(b) Given that the page table is stored in the main memory, and page faults cause costly disk accesses,
why is paging still used? Identify the additional techniques over pure paging that make paging effective,
briefly explaining how. (5)

~J\f<JV

- Page 4 of 4 -

You might also like