2020-06-05 00:21:03 +00:00
|
|
|
---
|
2020-06-15 23:19:07 +00:00
|
|
|
id: bfs
|
2020-06-05 00:21:03 +00:00
|
|
|
title: "Breadth First Search"
|
|
|
|
author: Benjamin Qi
|
|
|
|
prerequisites:
|
2020-06-22 20:51:12 +00:00
|
|
|
- Silver - Depth First Search
|
2020-06-22 19:59:16 +00:00
|
|
|
description: Traversing a graph in a way such that vertices closer to the starting vertex are processed first.
|
2020-06-05 00:21:03 +00:00
|
|
|
---
|
|
|
|
|
2020-06-24 23:24:24 +00:00
|
|
|
import { Problem } from "../models";
|
|
|
|
|
|
|
|
export const metadata = {
|
|
|
|
problems: {
|
|
|
|
sample: [
|
|
|
|
new Problem("CSES", "Message Route", "1667", "Easy", false, ["BFS"]),
|
|
|
|
],
|
|
|
|
general: [
|
|
|
|
new Problem("CSES", "Monsters", "1194", "Easy", false, ["BFS"]),
|
|
|
|
new Problem("Gold", "Cow Navigation", "695", "Easy", false, ["BFS"], "lots of casework"),
|
|
|
|
new Problem("CSA", "BFS-DFS", "bfs-dfs", "Normal", false, ["BFS", "DFS"]),
|
|
|
|
new Problem("Gold", "Lasers", "671", "Normal", false, ["BFS"]),
|
|
|
|
new Problem("Gold", "Dream", "575", "Hard", false, ["BFS"]),
|
|
|
|
],
|
|
|
|
}
|
|
|
|
};
|
2020-06-05 00:21:03 +00:00
|
|
|
|
2020-06-23 17:27:41 +00:00
|
|
|
<info-block title="Pro Tip">
|
|
|
|
No silver problem should require BFS rather than DFS, but it's still good to know at this level.
|
|
|
|
</info-block>
|
|
|
|
|
2020-06-24 23:24:24 +00:00
|
|
|
## Sample
|
|
|
|
|
|
|
|
<problems-list problems={metadata.problems.sample} />
|
|
|
|
|
|
|
|
## Tutorial
|
2020-06-05 00:21:03 +00:00
|
|
|
|
2020-06-23 01:00:35 +00:00
|
|
|
- CPH 12.2
|
|
|
|
- [PAPS 12.1](https://www.csc.kth.se/~jsannemo/slask/main.pdf)
|
2020-06-05 00:21:03 +00:00
|
|
|
- [CSAcademy BFS](https://csacademy.com/lesson/breadth_first_search)
|
|
|
|
- [cp-algo BFS](https://cp-algorithms.com/graph/breadth-first-search.html)
|
|
|
|
- [cp-algo 0/1 BFS](https://cp-algorithms.com/graph/01_bfs.html)
|
|
|
|
- [KhanAcademy BFS](https://www.khanacademy.org/computing/computer-science/algorithms/breadth-first-search/a/breadth-first-search-and-its-uses)
|
|
|
|
|
2020-06-24 23:24:24 +00:00
|
|
|
## Problems
|
|
|
|
|
|
|
|
<problems-list problems={metadata.problems.general} />
|