vu

Notes for Vanderbilt University

View the Project on GitHub

Lecture 02-17-17

Take home exam 3 review

  1. Shortest path does not remain the same
    • Increasing longer paths by more than shorter paths
    • Most of the credit:
      • Prim’s
  2. 5 to all weights
    • Partial:
      • Prim’s / Kruskal’s algorithm would process all the same
    • Full proof:
      • Prove that every spanning tree can be constructed by ties during Prim’s / Kruskal’s
      • If every spanning tree has exactly n - 1 edges, therefore every tree on n vertices must be n
        • Cost of old tree + 5 * (n - 1) which means must be
        • Because if another that was better, it’d be exactly the same so if better in one, better in other
  3. Design O(k(n + m)) MST for integer weights
    • Key point: always looking for best edge out of the tree
      • Before: kept cost of best edge to each vertex, had to scan entire array
      • Kept lists of edges of weight 1 to k
      • Old array:
      • Double linked list
    • To find smallest edge out of current tree: scan array of k
    • To use kruskals: can sort edges in O(m)
      • Problem is that almost linear time O(alpha(n))
  4. Truck clearance
    • Variant of Djikstra / MST
    • Maximum MST

Huffman Codes