GATE 2011
81 questions
MCQ 811-mark 40 · 2-mark 41
Questions 31–35 of 81
Which of the given options provides the increasing order of asymptotic complexityoffunctions f1, f2, f3 and f4?
Answer: (A)
Let us check each function:
- grows more slowly than
- grows faster than any polynomial
- but , so
Answer:
- grows more slowly than
- grows faster than any polynomial
- but , so
Answer:
Four matrices M1, M2, M3 and M4 are dimensions p x q, q x r, r x s and s x t respectively can be multiplied in several ways with different number of total scalar multiplications. For example When multiplied as the total number of scalar multiplications is pqr+rst+prt. When multiplied as , the total number of scalar multiplications is pqr+prs+pst. If p=10, q=100, r=20, s=5 and t=80, then the minimum number of scalar multiplications needed is
Answer: (C)
The matrices are , , , . Multiplying a matrix by a matrix costs scalar multiplications. There are 5 ways to bracket four matrices:
1. : 1010020 + 10205 + 10580 = 20000 + 1000 + 4000 = 25000
2. : 100205 + 101005 + 10580 = 10000 + 5000 + 4000 = 19000
3. : 20000 + 20580 + 102080 = 20000 + 8000 + 16000 = 44000
4. : 10000 + 100580 + 1010080 = 10000 + 40000 + 80000 = 130000
5. : 8000 + 1002080 + 1010080 = 8000 + 160000 + 80000 = 248000
The smallest is 19000, from .
Answer: (C)
1. : 1010020 + 10205 + 10580 = 20000 + 1000 + 4000 = 25000
2. : 100205 + 101005 + 10580 = 10000 + 5000 + 4000 = 19000
3. : 20000 + 20580 + 102080 = 20000 + 8000 + 16000 = 44000
4. : 10000 + 100580 + 1010080 = 10000 + 40000 + 80000 = 130000
5. : 8000 + 1002080 + 1010080 = 8000 + 160000 + 80000 = 248000
The smallest is 19000, from .
Answer: (C)
An algorithm to find the length of the longest monotonically increasing sequence of numbers in an array A[0 :n-1] is given below.
Let Li denote the length of the longest monotonically increasing sequence starting at index i in the array
Initialize .
For all such that
Finally the length of the longest monotonically increasing sequence is .
Which of the following statements is TRUE?
Let Li denote the length of the longest monotonically increasing sequence starting at index i in the array
Initialize .
For all such that
Finally the length of the longest monotonically increasing sequence is .
Which of the following statements is TRUE?
Answer: (A)
Going from right to left, we find by using , which was already computed and stored as a sub-result. This is the dynamic programming approach.
Answer: The algorithm uses dynamic programming paradigm
Answer: The algorithm uses dynamic programming paradigm
An undirected graph G(V, E) contains n (n2) nodes named v1 , v2 ,...,vn. Two nodes vi , vj are connected if and only if 0|i-j|2. Each edge (vi,vj ) is assigned a weight i+j. A sample graph with n=4 is shown below.
The length of the path from v5 to v6 in the MST of previous question with n = 10 is
The length of the path from v5 to v6 in the MST of previous question with n = 10 is
Answer: (C)
The edge has weight and the edge has weight .
MST by Kruskal. The edges in increasing order are
- and are taken. Then closes a cycle with them, so it is rejected.
- Each edge (weight ) brings in the new vertex , whose lightest edge it is, so it is taken.
- Each edge with (weight ) comes after both and are already joined to the tree through lighter edges, so it closes a cycle and is rejected.
So the MST has the odd vertices in one chain (), the even vertices in another chain (), and the edge joining the two chains.
Path from to : . Its length is .
Answer: (C)
MST by Kruskal. The edges in increasing order are
- and are taken. Then closes a cycle with them, so it is rejected.
- Each edge (weight ) brings in the new vertex , whose lightest edge it is, so it is taken.
- Each edge with (weight ) comes after both and are already joined to the tree through lighter edges, so it closes a cycle and is rejected.
So the MST has the odd vertices in one chain (), the even vertices in another chain (), and the edge joining the two chains.
Path from to : . Its length is .
Answer: (C)
An undirected graph G(V, E) contains n (n2) nodes named v1 , v2 ,...,vn. Two nodes vi , vj are connected if and only if 0|i-j|2. Each edge (vi,vj ) is assigned a weight i+j. A sample graph with n=4 is shown below.
What will be the cost of the minimum spanning tree (MST) of such a graph with n nodes?
What will be the cost of the minimum spanning tree (MST) of such a graph with n nodes?
Answer: (B)
The edge has cost and the edge has cost .
MST by Kruskal. Take (cost 3) and (cost 4). Then (cost 5) closes a cycle and is rejected. For each , the vertex is joined by its lightest edge , of cost . The edge (cost ) is rejected, because by then and are already connected through lighter edges.
Total cost:
Check with : the MST has 3, 4, 6, 8, so the cost is 21, and . For options (A), (B), (C) all give 13, but for (A) gives about 20.8 and (C) gives 19, so they are wrong.
Answer: (B)
MST by Kruskal. Take (cost 3) and (cost 4). Then (cost 5) closes a cycle and is rejected. For each , the vertex is joined by its lightest edge , of cost . The edge (cost ) is rejected, because by then and are already connected through lighter edges.
Total cost:
Check with : the MST has 3, 4, 6, 8, so the cost is 21, and . For options (A), (B), (C) all give 13, but for (A) gives about 20.8 and (C) gives 19, so they are wrong.
Answer: (B)