知识卡片

普通读书笔记卡 · 3645.i.5.a.1

Floyd三重循环求全点对

理解等级:中级

Floyd-Warshall 从 D^(0)=W 出发,依次让 k 从1到 n,每轮遍历所有(i,j)并使用经 k 的候选权更新。

每个三元组只做常数工作,总时间 Θ(n³)。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《算法导论(第4版)》第23章《所有结点对的最短路径》(OEBPS/chapter023.xhtml,文本字符[20000,25000))。 - 结论依据:原文伪代码按 k、i、j 三层循环,并给出 Θ(n³) 分析。 - 原始内容:Based on recurrence (23.6), the bottom-up procedure F LOYD -W ARSHALL computes the values in order of increasing values of k . Its input is an n × n matrix W defined as in equation (23.1). The procedure returns the matrix D ( n