Breadth First Search vs. Depth First Search

I graduated from my coding immersive at Grace Hopper Fullstack Academy and am reviewing some data structures and algorithms for interviews. I’ll be posting about some topics here to keep track of my progress and hopefully it will be helpful if you’re learning how to code also! Any tips would also be appreciated :)


A) Depth First (by Branch)

  • Pre-Order: Process Root, Left Subtree, Right Subtree
  • In-Order: Process Left Subtree, Root Node, Right Subtree
  • Post-Order: Process Left Subtree, Right Subtree, Root Node

B) Breadth First (by Level)

  • Use a queue!