ClassS04CS141/Review

ClassS04CS141 | ClassS04CS141 | recent changes | Preferences

Showing revision 15
GeometricSums

BoundingSums

GrowableArray

UnionFind

T(n) = 3T(n-3); T(0) = 1;
S(n) = 3S(n/3); T(0) = 1;
For each tree, what is the depth and how many children does each node have?
Give the best O and Θ bounds you can on T(n) and S(n).

Graphs

DepthFirstSearch

BreadthFirstSearch

CutVerticesByDFS

DiGraphs DFSInDiGraphs

CyclesByDFS

TopologicalSortByDFS

GraphDataStructures

CountingPathsByDP

FibonacciByDP

1. int fib(n) { if (n<= 1) return n; return f(n-1)+f(n-2); }
Argue that the depth of the tree is at least n/2 and at most n.
Argue that the running time of the algorithm is at least 2n/2.

NChooseKByDP

SubsetSumByDP

KnapsackByDP - not covered in class

MinWtTriangulationByDP

TransitiveClosureByDP (not covered) DynamicProgramming (summary)

ShortestPathsByDijkstras

ShortestPathsByDP

MinimumSpanningTreesByKruskals /MinimumSpanningTreeExercises (/MSTExerciseSolutions)


Homeworks

/Hw1, /Hwk1Soln

  1. Stack via shrinkable array
  2. Union-Find using parent pointers
  3. O-notation, sums
  4. Induction
  5. Recurrence relations

/Hwk2, /Hwk2Soln

  1. Simulate DFS on a directed graph
  2. Classification of edges
  3. Algorithm for topologically sorting a directed acyclic graph
  4. Prove that the root vertex of the DFS tree is a cut vertex iff it has more than one child in the DFS tree

/Hwk3, /Hwk3Soln

1,2. Variations on counting paths.
3. Longest ascending subsequences by dynamic programming.

/Hwk4, /Hwk4Soln (maximum shared subsequence)

  1. example
  2. prove the recurrence relation
  3. bound the running time of the recursive algorithm without caching.
  4. describe a faster algorithm, prove correctness, bound running time.
  5. implement and run the algorithm.

/Hwk5, /Hwk5Soln

  1. Run Dijkstra's on example.
  2. maximum bottleneck paths.
  3. minimum spanning tree example.
  4. shortest vertex-weighted paths
  5. maximum bottleneck paths.

/Hwk6, /Hwk6Soln

  1. non-uniqueness of shortest path trees even if all edge weights are distinct
  2. s,t-cut vertices
  3. red and blue rules for finding MST's.


Programming projects

  1. /Prog1 - growable array, hash table
  2. /Prog2 - graph class
  3. /Prog3 - finding a path through a maze
  4. /Prog4 - distances in a maze
  5. /Prog5 - shortest vertex-weighted paths
  6. /Prog6 - finding cut vertices, s,t-cut vertices

ClassS04CS141 | ClassS04CS141 | recent changes | Preferences
This page is read-only | View other revisions | View current revision
Edited June 4, 2004 2:39 pm by Neal (diff)
Search: