COMP3609 Algorithms and Complexity (Advanced)
Edmund Tse 2008
o
Sort points in 2-strip by their y coordinate.
o
Only check distances of those within 11 positions in sorted list!
o
o
Def. Let si be the point in the 2-strip, with the ith smallest y-coordina
COMP3609 Algorithms and Complexity (Advanced)
Edmund Tse 2008
Invariant. Every flow value f(e) and every residual capacities cf(e) remains an integer throughout
the algorithm
Theorem. The algorithm terminates in at most v(f*) nC iterations.
Pf. Each augm
COMP3609 Algorithms and Complexity (Advanced)
o
Edmund Tse 2008
But getting stuck might be a local optimum, not global optimum
Residual graph: Gf = (V, Ef)
Original edge: e = (u, v) E.
Residual edge: undo flow sent
Flow f(e), capacity c(e)
e = (u, v), e
COMP3609 Algorithms and Complexity (Advanced)
Edmund Tse 2008
Chapter 6 Dynamic Programming
Algorithmic Paradigms
Greedy. Build up a solution incrementally, myopically optimising some local criterion.
Divide-and-conquer. Break up a problem into two sub-pr
COMP3609 Algorithms and Complexity (Advanced)
o
o
o
Edmund Tse 2008
Algorithm: each router performs n separate computations, one for each potential destination node.
Routing by rumour
Caveat. Edge costs may change or fail completely during the algorithm
P
COMP3609 Algorithms and Complexity (Advanced)
Edmund Tse 2008
o
o
Theorem. Let T(m, n) = max running time on strings of length at most m and n. T(m, n) = O(mn log n).
Remark. Analysis is not tight because two sub-problems are of size (q, ) and (m q, ) .
R
COMP3609 Algorithms and Complexity (Advanced)
Edmund Tse 2008
Algorithm
o
Analysis. (mn) time and space
English words or sentences: m, n 10
Computational biology: m = n = 100,000. Memory requirements too large
Sequence alignment in linear space
Can we a
COMP3609 Algorithms and Complexity (Advanced)
Edmund Tse 2008
Bipartite matching
o Input. Undirected, bipartite graph G = (L R, E)
o M E is a matching if each node appears in at most one edge in M
o Max matching. Find a maximum cardinality matching
Max fl
COMP3609 Algorithms and Complexity (Advanced)
o
Edmund Tse 2008
Do some post-processing. # of recursive calls n O(n)
Bottom-up dynamic programming. Unwind recursion
Knapsack Problem
Knapsack problem
o Given n objects and a knapsack
o Item i weighs wi > 0
COMP3609 Algorithms and Complexity (Advanced)
Edmund Tse 2008
Flows
o Def. An s-t flow is a function that satisfies:
For each e E:
0 ( ) ( )
f (e) = f (e)
For each v V = cfw_s, t
e into v
o
Def. The value of a flow f is:
(capacity)
(conservation)
e out