Kruskal 最小生成树算法 :: labuladong的算法小抄 #1086
Replies: 12 comments 2 replies
-
为什么一个连通分量就是一颗树啊? |
Beta Was this translation helpful? Give feedback.
-
这俩题都要plus会员🤢 |
Beta Was this translation helpful? Give feedback.
-
是不是无向图找环只能用UF方案啊?感觉之前有向图的找环代码在这里不可用。 |
Beta Was this translation helpful? Give feedback.
-
@jswxwxf UF 是一种方案,普通的 BFS/DFS 当然也可以,用 |
Beta Was this translation helpful? Give feedback.
-
@victory460 如果有大于一个连通分量,就不是一棵树了,有 n 个连通分量就有 n 棵树(如果都是树的话) |
Beta Was this translation helpful? Give feedback.
-
东哥那这题的话上一讲uf运用最短压缩路径的写法是不是就不能用了?因为用到了size |
Beta Was this translation helpful? Give feedback.
-
@victory460 我的理解的 多个连通分量 就成了一个森林了 每个连通分量是森林的一棵树。 |
Beta Was this translation helpful? Give feedback.
-
c++
|
Beta Was this translation helpful? Give feedback.
-
C++,递归findRoot压缩
|
Beta Was this translation helpful? Give feedback.
-
这种题正常回溯就能解决,,对return做好处理就行。最小生成树不用也罢 |
Beta Was this translation helpful? Give feedback.
-
prim快的多
|
Beta Was this translation helpful? Give feedback.
-
只要东哥写的,肯定看,支持东哥 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
文章链接点这里:Kruskal 最小生成树算法
评论礼仪 见这里,违者直接拉黑。
Beta Was this translation helpful? Give feedback.
All reactions