mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-20 18:46:06 +00:00
feat: Add glossary and description for "哈希集合" (#1310)
This commit is contained in:
@@ -15,7 +15,7 @@ use std::collections::{HashSet, VecDeque};
|
||||
fn graph_bfs(graph: GraphAdjList, start_vet: Vertex) -> Vec<Vertex> {
|
||||
// 顶点遍历序列
|
||||
let mut res = vec![];
|
||||
// 哈希表,用于记录已被访问过的顶点
|
||||
// 哈希集合,用于记录已被访问过的顶点
|
||||
let mut visited = HashSet::new();
|
||||
visited.insert(start_vet);
|
||||
// 队列用于实现 BFS
|
||||
|
||||
@@ -31,7 +31,7 @@ fn dfs(graph: &GraphAdjList, visited: &mut HashSet<Vertex>, res: &mut Vec<Vertex
|
||||
fn graph_dfs(graph: GraphAdjList, start_vet: Vertex) -> Vec<Vertex> {
|
||||
// 顶点遍历序列
|
||||
let mut res = vec![];
|
||||
// 哈希表,用于记录已被访问过的顶点
|
||||
// 哈希集合,用于记录已被访问过的顶点
|
||||
let mut visited = HashSet::new();
|
||||
dfs(&graph, &mut visited, &mut res, start_vet);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user