LogoLearning For Everyone
Take Quiz
Contact Us
Related Topics
Related Topics
Selected Topic: All
1. Depth First Search is equivalent to which of the traversal in the Binary Trees?
Choose the correct option:
  • a) Pre-order Traversal

  • b) Post-order Traversal

  • c) Level-order Traversal

  • d) In-order Traversal

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.

2. Time Complexity of DFS is? (V – number of vertices, E – number of edges)
Choose the correct option:
  • a) O(V + E)

  • b) O(V)

  • c) O(E)

  • d) O(V*E)

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

3. The Data structure used in standard implementation of Breadth First Search is?
Choose the correct option:
  • a) Stack

  • b) Queue

  • c) Linked List

  • d) Tree

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

4. The Depth First Search traversal of a graph will result into?
Choose the correct option:
  • a) Linked List

  • b) Tree

  • c) Graph with back edges

  • d) Array

The Depth First Search will make a graph which don’t have back edges (a tree) which is known as Depth First Tree.

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 vertex, backtracks and then explore other vertex from same vertex. What algorithm he should use?
Choose the correct option:
  • a) Depth First Search

  • b) Breadth First Search

  • c) Trim’s algorithm

  • d) Kruskal’s Algorithm

This is the definition of the Depth First Search. Exploring a node, then aggressively finding nodes till it is not able to find any node.

Items per page: