Depth-First Search (DFS) of a graph uses which auxiliary data structure?

  • A Queue
  • B Stack
  • C Array
  • D Linked list

Explanation

DFS goes as deep as possible along each branch before backtracking, which is naturally implemented with a stack (or recursion).