# Data Structure Questions and Answers-Depth First Search

## Click on any option to know the CORRECT ANSWERS

 Question 1
Depth First Search is equivalent to which of the traversal in the Binary Trees?
 A Pre-order Traversal B Post-order Traversal C Level-order Traversal D In-order Traversal

Question 1 Explanation:
In Depth First Search, we explore all the nodes aggressively to one path and then backtrack to the node. Hence, it is equivalent to the pre-order traversal of a Binary Tree.

 Question 2
Time Complexity of DFS is? (V - number of vertices, E - number of edges)
 A O(V + E) B O(V) C O(E) D None of the mentioned

Question 2 Explanation:
The Depth First Search explores every node once and every edge once (in worst case), so it's time complexity is O(V + E).

 Question 3
The Data structure used in standard implementation of Breadth First Search is?
 A Stack B Queue C Linked List D None of the mentioned

Question 3 Explanation:
The Depth First Search is implemented using recursion. So, stack can be used as data structure to implement depth first search.

 Question 4
The Depth First Search traversal of a graph will result into?
 A Linked List B Tree C Graph with back edges D None of the mentioned

Question 4 Explanation:
The Depth First Search will make a graph which don't have back edges (a tree) which is known as Depth First Tree.

 Question 5
A person wants to visit some places. He starts from a vertex and then wants to visit every vertex till it finishes from one verte, x backtracks and then explore other vertex from same vertex. What algorithm he should use?
 A Depth First Search B Breadth First Search C Trim's algorithm D None of the mentioned