Add the section of hash algorithm. Refactor the section of hash map. (#555)

This commit is contained in:
Yudong Jin
2023-06-16 21:20:57 +08:00
committed by GitHub
parent 4dddbd1e67
commit 29e6617ec1
9 changed files with 459 additions and 36 deletions

View File

@@ -36,7 +36,7 @@ class GraphAdjMat {
// 向顶点列表中添加新顶点的值
vertices.push_back(val);
// 在邻接矩阵中添加一行
adjMat.emplace_back(n, 0);
adjMat.emplace_back(vector<int>(n, 0));
// 在邻接矩阵中添加一列
for (vector<int> &row : adjMat) {
row.push_back(0);