mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-15 13:10:59 +00:00
feat: Add glossary and description for "哈希集合" (#1310)
This commit is contained in:
@@ -14,7 +14,7 @@ import java.util.*
|
||||
fun graphBFS(graph: GraphAdjList, startVet: Vertex): MutableList<Vertex?> {
|
||||
// 顶点遍历序列
|
||||
val res = mutableListOf<Vertex?>()
|
||||
// 哈希表,用于记录已被访问过的顶点
|
||||
// 哈希集合,用于记录已被访问过的顶点
|
||||
val visited = HashSet<Vertex>()
|
||||
visited.add(startVet)
|
||||
// 队列用于实现 BFS
|
||||
|
||||
@@ -31,7 +31,7 @@ fun dfs(
|
||||
fun graphDFS(graph: GraphAdjList, startVet: Vertex?): MutableList<Vertex?> {
|
||||
// 顶点遍历序列
|
||||
val res = mutableListOf<Vertex?>()
|
||||
// 哈希表,用于记录已被访问过的顶点
|
||||
// 哈希集合,用于记录已被访问过的顶点
|
||||
val visited = HashSet<Vertex?>()
|
||||
dfs(graph, visited, res, startVet)
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user