GATE 2006
191 questions
MCQ 1911-mark 191
Questions 116–120 of 191
Answer: (D)
Key fact: in a DFS of an undirected graph, every non-tree edge joins a vertex to one of its ancestors (there are no cross edges).
Let be a leaf of the DFS tree . Take any neighbour of . If were unvisited when DFS reached , DFS would go to it and would get a child, which is false. If had already finished, it would have visited itself. So is visited but not finished, which means it is an ancestor of on the root-to- path.
The figure shows this for two neighbours K and L of (drawn as U); all are on the current DFS path. Since , has its parent and at least one more neighbour, which is a higher ancestor. Let be the highest neighbour of . The tree path from down to , closed by the edge , is a cycle. All other neighbours of lie on that path (they are ancestors below ). So (D) is always true.
(A), (B), (C) can fail. Take triangles and joined by the edge . DFS from (order b, a, u, c, d, v) has leaves and , each of degree 2. They have no common neighbour, so (A) fails. No cycle contains both, since is a bridge, so (C) fails. For (B), take with parts and . DFS order a, x, b, y, z gives leaves and of degree 2, and removing any single vertex leaves them connected, so (B) fails.
Answer: (D)Which one of the following cannot be the sequence of edges added, in that order, to a minimum spanning tree using Kruskal's algorithm?
Answer: (D)
Kruskal's algorithm picks edges in non-decreasing order of weight. In option D, edge with weight is added before edge with weight . So option D cannot be a valid sequence.
Correct Answer:
Answer: (B)
A spanning tree on vertices has edges, so its weight is at least .
The path joins only adjacent vertices. Each of its edges weighs , so it reaches this lower bound.
Weight of the minimum spanning tree .
Answer: (B)
Answer: (A)
A heap (C) is needed only when edge weights differ, and it adds a factor. A stack (B) gives depth-first order, which does not give shortest paths. A B-tree (D) is a disk-based search structure and does not help here.
Answer: (A)
Answer: (A)
Let the states be and , taken in order from the start state, which is .
Start state: [Arden's theorem says if , then ][the term is there since this is the start state]
Next:
Then:
Finally:
The state is the final state, so the regular expression is . It is the set of strings whose third symbol from the end is a and whose last symbol is b.
The other options are wrong:
- (B) rejects , but the automaton accepts it ().
- (C) accepts , but the shortest accepted string has length 3.
- (D) accepts , but the start state is not final.
Answer: (A)