GATE 2000
54 questions
MCQ 541-mark 54
Questions 6–10 of 54
Answer: (C)
Take the tree in the figure as the graph (edges read as undirected). One DFS from visits G, E, B, D, F, K, M, R. Here and the next new vertex is .
(A), (B): D and F are not joined by an edge, so need not be an edge.
(D): the parent of D is B and the parent of F is E, so they need not share a parent.
(C): suppose is not an edge. When DFS is at , if had any unvisited neighbour, DFS would go to one of them next, and that neighbour would be the next new vertex . Then would be an edge. Since it is not, had no unvisited neighbour, so DFS gave no child. So is a leaf of .
Answer: (C)
BFS uses a queue directly in the algorithm.
Heap goes with Heapsort.
Answer: (C)
Answer: (C)
and are independent The value of Pr\left ( E_{1} \right ), the probability of the event E_{1}, is
Answer: (D)
The events are independent, so . Put in the values:
Answer: (D)
Answer: (C)
When DFS visits , it goes to an unvisited neighbour of if there is one. So if has an unvisited neighbour, the next new vertex is that neighbour, and is an edge. If is not an edge, then had no unvisited neighbour, so it gets no children in . It is a leaf, so (C) is always true.
Example: take the tree above as the graph, with DFS order G, E, B, D, F, K, M, R. For the next new vertex is .
- (A) and (B) say must be an edge. D-F is not an edge, so both fail.
- (D) says and have the same parent. D has parent B and F has parent E, so it fails.
Answer: (C)