From 00f4a045fcd27efe1ab25aa862f94431aa7041f3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 2 Sep 2025 08:21:46 +0000 Subject: [PATCH] deploy: e13b3dc49abcb477f1d6e042a09174c90a748063 --- ch5/ch5-06.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch5/ch5-06.html b/ch5/ch5-06.html index d2cb195..921ead7 100644 --- a/ch5/ch5-06.html +++ b/ch5/ch5-06.html @@ -613,7 +613,7 @@ func topoSort(m map[string][]string) []string { // ... } -

在toposort程序的输出如下所示,它的输出顺序是大多人想看到的固定顺序输出,但是这需要我们多花点心思才能做到。哈希表prepreqs的value是遍历顺序固定的切片,而不再试遍历顺序随机的map,所以我们对prereqs的key值进行排序,保证每次运行toposort程序,都以相同的遍历顺序遍历prereqs。

+

在toposort程序的输出如下所示,它的输出顺序是大多人想看到的固定顺序输出,但是这需要我们多花点心思才能做到。哈希表prepreqs的value是遍历顺序固定的切片,而不再是遍历顺序随机的map,所以我们对prereqs的key值进行排序,保证每次运行toposort程序,都以相同的遍历顺序遍历prereqs。

1: intro to programming
 2: discrete math
 3: data structures