Post

DFS & BFS

✅ DFS

Depth First Search
stack, recursion
visit all the depth before going onto next branch
edge-based technique

⭐️ Keyword

  • subset(부분집합)

✅ Time complexity

Adjacency Matrix: O(V^2)
Adjacency List: O(V+E)
V: node
E: edges

✅ BFS

Breath First Search
queue
vertex-based technique

⭐️ Keyword

  • least cost
  • per edge, +1
  • little number of node, edge

✅ Time complexity

Adjacency Matrix: O(V^2)
Adjacency List: O(V+E)
V: node
E: edges

✅ Code

https://soheeparklee.github.io/posts/CT-62/
https://soheeparklee.github.io/posts/CT-63/

This post is licensed under CC BY 4.0 by the author.