If you want to make money online : Register now

[Solved]: Why do Tarjan's and Kosaraju's algorithms for finding strongly connected components have the same running-time complexity?

, , No Comments
Problem Detail: 

I followed an explanation of Kosaraju's and Tarjan's strongly-connected components algorithms, and they say that both have O(|V|+|E|) time complexity.

That didn't make sense to me since Kosaraju uses two DFS passes and computes the transposed graph, but Tarjan's use only one DFS.

Asked By : aName

Answered By : Raphael

they say that both have O(|V|+|E|) time complexity.

that didn't make sens for me since Kosaraju use two dfs pass and compute transpose graph, but Tarjan's use only one dfs

If you check the definition of Landau notation you will see that it does not say which function is smaller, that is (here) which algorithm is faster. It ignores constant factors.

Both algorithms have running times in $\Theta(|V| + |E|)$; that does not preclude one of them being $2^{100}$ times faster than the other for all $n \leq 2^{100}$.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/62820

3.2K people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback