NPTEL MOOC: Algorithms for Big Data July — Sept, 2016
Assignment for Week 5 Total Marks: 20
Name: Roll No.:
Question: 1 2 3 4 5 6 7 8 9 10 Total
Marks: 2 2 2 2 2 2 2 2 2 2 20
Score:
1. (2 marks) Consider a family of hash functionsH such that for all hash functionsh∈H, h:U →V. Choose a hash functionhu.a.r. fromH. Suppose for all subsets{x1, . . . , x5} ⊆U and any choice ofyi∈V, 1≤i≤5, we are given that P r((h(x1) = y1)T(h(x2) = y2)T(h(x3) =y3)T(h(x4) =y4)T(h(x5) =y5)) = 1/n5. Consider the following two statements.
I.H is a 5-universal hash family.
II.H is a strongly 5-universal hash family.
Which of the following statements is correct?
A. I. and II. are both true.
B. I. is true, II. is false.
C. I. is false, II. is true.
D. I. and II. are both false.
2. (2 marks) Suppose we want to hash m elements into ann bin hash table using a hash function belonging to a k- universal hash family. LetAi be the event that theithelement is hashed into the first bin. LetS={Ai|1≤i≤m}.
Are we guaranteed that any set of eventsM ⊂S, |M|=k, are mutually independent?
A. Yes.
B. No.
3. (2 marks) Assume that we are using chain hashing, where the hash function is chosen u.a.r. from a strongly 2- universal hash family, to hash 20 elements into a 5 bin hash table. What is the expected search time if we search for an element not in one of the 20 hashed elements?
A. 3.
B. 4.
C. 5.
D. 6.
4. (2 marks) Assume that we are using chain hashing, where the hash function is chosen u.a.r. from a 4-universal hash family, to hash 20 elements into a 5 bin hash table. What is the closest approximation to the expected search time if we search for an element in one of the 20 hashed elements?
A. 3.
B. 4.
C. 5.
D. 6.
5. (2 marks) Suppose we want to hashmelements into annbin hash table using perfect hashing so that we get a query time ofO(1) queries per search. What relation ofmandnallows this?
Page 1 of 3
A. n=O(m2).
B. n=O(mlogm).
C. n=O(m).
D. All of the above.
E. None of the above.
6. (2 marks) Consider the matrixM =.3.3.3
.3.2.5 .4.5.2
. Consider the following two statements.
I.M is a stochastic matrix.
II.M is a doubly stochastic matrix.
Which of the following statements is correct?
A. I. and II. are both true.
B. I. is true, II. is false.
C. I. is false, II. is true.
D. I. and II. are both false.
7. (2 marks) Consider a random walk on an n node graph with nodes n1, n2, . . . , nn with the following transition probabilities.
1. The probability of moving from nodeni to ni+1 is 1/2, 1≤i≤n−1.
2. The probability of moving fromni ton1 is 1/2, 1≤i≤n.
3. The probability of moving fromnn to itself is 1/2.
Consider the following two statements.
I. The transition matrix of the random walk for the graph is stochastic.
II. The transition matrix of the random walk for the graph is doubly stochastic.
Which of the following statements is correct?
A. I. and II. are both true.
B. I. is true, II. is false.
C. I. is false, II. is true.
D. I. and II. are both false.
8. (2 marks) Consider a random walk on an nnode star graph with the following transition probabilities.
1. The transition probability from each node to itself is 1/2.
2. The transition probability from each leaf to the internal node is 1/2.
Suppose that the transition probability from the internal node to each leaf must be the same. What will this transition probability be so that the transition matrix of the random walk for the graph is stochastic?
A. 1n. B. n−11 . C. 2n1 . D. 2(n−1)1 .
9. (2 marks) Consider two nodesuandv in a lollipop graph such thatuis one of the nodes in then/2 clique andv is the node in the path farthest away from the clique. Consider the following two statements.
I. The expected time for a random walk starting atuto visit all nodes in the graph is Θ(n3).
II. The expected time for a random walk starting atv to visit all nodes in the graph is Θ(n3).
Which of the following statements is correct?
A. I. and II. are both true.
B. I. is true, II. is false.
C. I. is false, II. is true.
Name: Roll No.: Page 2 of 3
D. I. and II. are both false.
10. (2 marks) Consider the cat and mouse game on a path ofn nodes. What is the expected time for the cat to catch the mouse?
A. O(n2).
B. O(n2logn).
C. O(n3).
D. O(n4).
Name: Roll No.: Page 3 of 3