You are on page 1of 8

Comprehensive

Examination
Practice
-ASYMPTOTIC NOTATIONS

Sanjay S Kumar
S5 CSE
What is the time complexity of Bellman-Ford single-
source shortest path algorithm on a complete graph
of n vertices?
Explanation
Time complexity of Bellman-Ford algorithm is Θ(|V||E|)
where |V| is number of vertices and |E| is number of
edges. If the graph is complete, the value of |E|
becomes Θ(|V|^2). So overall time complexity
becomes Θ(|V|^3). And given here is n vertices. So,
the answer ends up to be Θ(n^3).

Answer is C.
Which one of the following is the tightest upper bound
that represents the time complexity of inserting an
object in to a binary search tree of n nodes?
Explanation
To insert an element, we need to search for its place
first. The search operation may take O(n) for a skewed
tree like following.

Answer is C.
The time complexity of computing the transitive
closure of a binary relation on a set of elements is
known to be:
Explanation
Calculating Transitive Closure boils down to Matrix
Multiplication.
We can do Matrix Multiplication in O(n3)

Answer is D.
THANK YOU

You might also like