Description
FALL 2025
1. Arrange these functions under the Big-πͺ notation in increasing order of growth rate, with
π(π) following π(π) in your list if and only if π(π) = πͺ(π(π)); mention equality (of
growth-rate) if π(π) = πͺ(π(π)) and also π(π) = πͺ(π(π)). Here, log(π₯) = log!(π₯), i.e.,
denotes the logarithm with base 2):
2″#$(&)
, log(π) , log(π!), π log(π!), log(log(π&)), 4(&, π& “#$(&)
, π&!
, 3)&
(10 points)
2. For each of the following, indicate whether π(π) β πͺ(π(π)), π(π) β Ξ(π(π)), or π(π) β
Ξ©(π(π)). Here, log(π₯) = log!(π₯), i.e., denotes the logarithm with base 2. (10 points)
(a) π(π) = π! and π(π) = 2!”
(b) π(π) = π& and π(π) = π”#$ &
(c) π(π) = 2& and π(π) = 2(&
(d) π(π) = π! and π(π) = 2*”#$ &
(e) π(π) = log π and π(π) = log(log(6!&))
3. We have a connected graph πΊ = (π, πΈ), and a specific vertex π’ β π. Suppose we compute a
DFS tree rooted at π’, and obtain a tree π (remember that a DFS tree includes all nodes of πΊ).
Suppose we then compute a BFS tree rooted at π’, and obtain the same tree π. Prove by
contradiction that πΊ is the same as π, that is, πΊ cannot contain any edges that do not belong
to π. (10 points)
Hint: For any edge (π₯, π¦) in πΊ, how much can the level of π₯ in the BFS T differ from the
level of π¦ in it? Further, what can we say about the locations of π₯ and π¦ relative to each other
in the DFS T?
4. Given an unweighted and undirected graph πΊ = (π, πΈ) and an edge π β πΈ. Design an
algorithm to determine whether the graph πΊ has a cycle containing that specific edge π. Also,
determine the time complexity of your algorithm with explanation. Note: To be eligible for
full credits on this problem, the running time of your algorithm should be bounded by
πͺ(|π| + |πΈ|). (10 points)
Ungraded Problems:
1. Given functions π+, π!, π+, π! such that π+(π) = πͺ(π+(π)) and π!(π) = πͺ(π!(π)). For each
of the following statements, decide whether you think it is true or false, and give a proof or
counterexample. (12 points)
(a) π+(π) + π!(π) = πͺ(max(π+(π), π!(π)))
(b) π+(π) β
π!(π) = πͺ(π+(π) + π!(π))
(c) π+(π)! = πͺ(π+(π)!)
(d) log π+(π) = πͺ(log(π+(π)))
2. Consider the following prime filtering algorithm that outputs all the prime numbers in 2, β¦ , π
(the pseudo code is presented in Algorithm 1). (10 points)
(a) Please prove this algorithm is correct (that is, a positive integer π that 2 β€ π β€ π is a
prime if and only if isPrime(π) = True). (5 points)
(b) Please calculate the time complexity under the Big-πͺ notation. (5 points)
3. A directed graph πΊ = (π, πΈ) is singly connected if πΊ contains at most one simple path from π’
to π£ for all vertices π’, π£ β π . Construct an algorithm using DFS to determine whether or not a
directed graph is singly connected. Also, determine the time complexity of your algorithm and
justify your answer. (10 points)