• retagged by
639 views
0 0 votes
What is the time complexity of best algorithm that decides whether a given directed

graph represented as adjacency Matrix contains a sink or not ?

(a)O(V^2)

(b)O(VlogV)

(c)O(V^2logV)

(d)O(V)

1 Answer

0 0 votes
To decide whether a $sink$ exists from an adjacency matrix, we need to traverse the whole matrix in the worst case. So the best algorithm requires $O(V^2)$ comparisons.

On the other hand, to find if a $universal\space sink$ exists from an adjacency matrix, the best algorithm requires $O(2V) = O(V)$ operations only, as we can skip each row and column on one comparison.

So, the answer is, $a$) $O(V^2).$
Position:
Show:

Related questions

2 2 votes
2 2 answers
192
192 views
Shubham Sharma 2 asked Apr 19
192 views
Which of the following is correct order of increasing time complexity of algorithmsTower of Hanoi with $n$ disk.Binary search given $n$ sorted numbers.Heap sort given $n$...
0 0 votes
2 answers 2 answers
1.1k
1.1k views
Pratik.patil asked Aug 31, 2023
1,053 views
Consider a relation R(A,B,C,D,E,F,G) and the following functional dependencies: (B->D, D->E, AB->C, AE-F, C - A, F - G } and choose the correct option:(A) Only A and B ar...
0 0 votes
0 0 answers
606
606 views
Neelu Lalchandani asked Nov 2, 2022
606 views
Time Complexity in C will be O(n) right? and big omega (n) is also big omega (n^2), then why is c incorrect?
0 0 votes
1 1 answer
760
760 views
gate_dreams asked Jan 27, 2019
760 views
for(i=n, j=0; i>0; i/=2, j+=i)Let val(j) denote the value stored in the variable j after termination of the for loop. Whjch is correct?a. val(j)=theta(logn)b. Val(j)= the...