Data Structure Questions and Answers-Depth First Search

YOU CAN DOWNLOAD 200+ SUBJECTS PDF BOOK FOR COMPETITIVE EXAMINATIONS

CLICK HERE TO DOWNLOAD

Data Structure Questions and Answers-Depth First Search

Question 6 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What can be the applications of Depth First Search?
A
For generating topological sort of a graph
B
For generating Strongly Connected Components of a directed graph
C
Detecting cycles in the graph
D
All of the mentioned
Question 6 Explanation: 
Depth First Search can be applied to all of the mentioned problems.

Question 7 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
When the Depth First Search of a graph is unique?
A
When the graph is a Binary Tree
B
When the graph is a Linked List
C
When the graph is a n-ary Tree
D
None of the mentioned
Question 7 Explanation: 
When Every node will have one successor then the Depth First Search is unique. In all other cases, when it will have more than one successor, it can choose any of them in arbitrary order.

Question 8 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Regarding implementation of Depth First Search using stacks, what is the maximum distance between two nodes present in the stack? (considering each edge length 1)
A
Can be anything
B
0
C
At most 1
D
Insufficient Information
Question 8 Explanation: 
In the stack, at a time, there can be nodes which can differ in many levels. So, it can be the maximum distance between two nodes in the graph.

Question 9 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In Depth First Search, how many times a node is visited?
A
Once
B
Twice
C
Equivalent to number of indegree of the node
D
None of the mentioned
Question 9 Explanation: 
In Depth First Search, we have to see whether the node is visited or not by it's ancestor. If it is visited, we won't let it enter it in the stack.

There are 9 questions to complete.