
Head-Banging Session 2
CS 473ug: Algorithms
Problem 1.[Algebraic Manipulation]
1. Prove the following identity: n
X
m=im
i=n+ 1
i+ 1
2. Using the previous identity, evaluate Pk
t=1 tand Pk
t=1 t2.
3. Prove Pk
t=1 tc= Θ(kc+1), for any c∈N. (Food for thought: Is the identity true when c∈R+?)
Problem 2.[Couple of Recurrences]
1. Solve the recurrence f(n) = 1 + f(√n).
2. If f(·) satisfies the recurrence f(n) = n+Pk
i=1 f(ain), where ai>0 (1 ≤i≤k) and Pk
i=1 ai<1,
then prove that f(n) = O(n). (You are not allowed to use the Master Theorem)
Problem 3.[Strongly Connected Components] We are given two black boxes:
1. BlackBox A: Given a directed graph Git outputs a list of strongly connected components in G.
2. BlackBox B: It takes as input a DAG G= (V, E ) and weight wvassociated with every vertex
v∈V. Given two vertices sand tin Gand a threshold τ, it outputs whether there exists a path
P={s=vi1→ ··· → vik=t}between sand t, such that Pv∈Pwv≥τ.
Using the above mentioned black boxes solve the following problems:
1. Given a DAG G= (V, E), how do we find whether there exists a path from sto t(s, t ∈V) such that
it visits at least cdifferent vertices.
2. Given a directed graph G, how do we find whether there exists a walk from sto t(s,t ∈V) such that
it visits at least cdifferent vertices.
Give an efficient algorithm to implement BlackBox B.
1