Single Choice Easy

QHow is the time complexity of the depth-first search (DFS) algorithm in a graph characterized?

ID: #21513 Time Complexity 83 views
Question Info
#21513Q ID
EasyDifficulty
Time ComplexityTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A O(N)
  • B O(log N)
  • C O(N^2)
  • D O(V + E), where V is the number of vertices and E is the number of edges.
Correct Answer

Explanation

The time complexity of DFS in a graph is O(V + E), where V is the number of vertices and E is the number of edges.

Share This Question

Challenge a friend or share with your study group.