Which of the following is a common application of DFS?

Options

  • A. Topological sorting
  • B. Finding minimum spanning tree using Kruskal's algorithm
  • C. Binary searching an array
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. Topological sorting

Detailed Explanation

DFS is commonly used for topological sorting of a Directed Acyclic Graph (DAG). During DFS-based topological sorting, vertices are typically placed into a result structure according to their finishing times. DFS is also useful for cycle detection, connected components, and path exploration. Kruskal's algorithm is instead a greedy Minimum Spanning Tree algorithm, while binary search works on ordered data rather than performing graph traversal.