Algorithm Analysis (CSC 301 2015F) : EBoards

CSC301.01 2015F, Class 27: Minimum Spanning Trees, Continued


Overview

Preliminaries

Admin

Questions

Three greedy approaches

Examples

Proofs of correctness

Running times

French's Algorithm

Order the edges by weight: O(mlogm)
For each edge, e, from largest to smallest:  m edges (m times ...)
  if removing edge e does not disconnect the graph, n+m for connectivity
    remove edge e

O(m^2 + mn)

Prim's Algorithm

Add v to MST
While there are vertices not in the MST,            O(n)
  find the closest vertex and add it to the MST     O(m) for obvious;
                                                    O(n) for clever

O(nm) or O(n^2)

Kruskal's Algorithm

Order the edges by weight: O(mlogm)
While the graph is disconnected
  add the smallest edge between two non-connected components