Lecture 23 - Review Flashcards

1
Q

What’s the running time of Fast exponentiation? How is this obtained?

A

Q(logn)

Observation: x^2k = (x^2)^k and x^(2k+1) = x * (x^2)^k

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the three proof techniques we learned?

A
  1. Loop invariants.
  2. Contradiction
  3. Cut and Paste
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Prove that any subpath of a shortest path is a shortest path.

A
Suppose this path p is a shortest path from u to v.
Then δ(u,v) = w(p) = w(pux) + w(pxy) + w(pyv).
Now suppose there exists a shorter path p'xy.
Then w(p’xy)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Prove the following Theorem 1: Let (S, V-S) be any cut that respects A, and let (u, v) be
a light edge crossing (S, V-S). Then, (u, v) is safe for A.

A

Lec 23 - Slide 29

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Prove the correctness of Djikstra’s.

DIJKSTRA(V, E,w,s):
INIT-SINGLE-SOURCE(V,s)
S ← ∅
Q ← V
while Q ≠ ∅ do
........u ← EXTRACT-MIN(Q)
........S ← S ∪ {u}
........for each vertex v∈Adj[u] do
................RELAX(u,v,w)
A

Initialization
Initially, S = ∅ ⟹ True

Loop Invariant:
At the start of each iteration:
d[v] = δ(s,v) ∀v ∈ S.

Termination:
Stops when Q=∅ ⇒
d[v] = δ(s,v) ∀ v ∈ V
(by Loop Invariant Property)

Maintenance:
Show that d[u] = δ(s,u) when
u is added to S in each
Iteration.

(check original lecture slide for proof)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Give the steps to calculate a min cut.

A

To find a min cut compute a max flow.
To find the cut run BFS (or DFS) from s on the residual graph.
The reachable vertices define the (min) cut.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly