Add the codes of hashmap (#553)

of chaining and open addressing
This commit is contained in:
Yudong Jin
2023-06-14 02:01:06 +08:00
committed by GitHub
parent d3e597af94
commit 9563965a20
27 changed files with 1280 additions and 207 deletions

View File

@@ -72,12 +72,12 @@ public class GraphAdjList {
/* */
public func print() {
Swift.print("邻接表 =")
for entry in adjList {
for pair in adjList {
var tmp: [Int] = []
for vertex in entry.value {
for vertex in pair.value {
tmp.append(vertex.val)
}
Swift.print("\(entry.key.val): \(tmp),")
Swift.print("\(pair.key.val): \(tmp),")
}
}
}