[Leetcode for Interviews]DFS, BFS, and Backtracking I

After Intro to Graph Algorithms – BFS & DFS, let’s take a look at some popular and most common interview questions. Questions that fall under this category are quite typical and static, so it’s not difficult to master them if you go through the following lists, and then you will find patterns in their solutions.

The steps for using BFS and DFS are straightforward – construct a graph G=(V+E) first and then start exploring. So this post will list the BFS and DFS questions that are highly recommended for practicing. In the next post, [Leetcode for Interview]DFS, BFS, and Backtracking II – How to backtrack? Detailed Explanations with Examples, we will talk about how to implement DFS with pruning – Backtracking.

Notably, since BFS and DFS would literally exhaust every possible path in the graph, sometimes it might not be as efficient as other algorithms such as Dynamic Programming and Greedy Algorithms etc..

Breadth-First-Search

Depth-First-Search

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments