Similarities

  • same time complexity

Differences

ParametersBFSDFS
Data structureQueueStack
ApproachAll nodes on the same level is traversed before moving to the next levelPrioritizes going as far as possible and then backtracks when no further path is available
Conceptual differenceBuilds the tree level by levelBuilds the tree subtree by subtree
Nature of ADTFIFO (queue)LIFO (stack)