mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-13 20:20:58 +00:00
feat: Add glossary and description for "哈希集合" (#1310)
This commit is contained in:
@@ -14,7 +14,7 @@ List<Vertex> graphBFS(GraphAdjList graph, Vertex startVet) {
|
||||
// 使用邻接表来表示图,以便获取指定顶点的所有邻接顶点
|
||||
// 顶点遍历序列
|
||||
List<Vertex> res = [];
|
||||
// 哈希表,用于记录已被访问过的顶点
|
||||
// 哈希集合,用于记录已被访问过的顶点
|
||||
Set<Vertex> visited = {};
|
||||
visited.add(startVet);
|
||||
// 队列用于实现 BFS
|
||||
|
||||
@@ -30,7 +30,7 @@ void dfs(
|
||||
List<Vertex> graphDFS(GraphAdjList graph, Vertex startVet) {
|
||||
// 顶点遍历序列
|
||||
List<Vertex> res = [];
|
||||
// 哈希表,用于记录已被访问过的顶点
|
||||
// 哈希集合,用于记录已被访问过的顶点
|
||||
Set<Vertex> visited = {};
|
||||
dfs(graph, visited, res, startVet);
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user