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) Algorithms algorithms time-complexity matrix + – Aniket1710 639 views answer comment Share Follow Print See 1 comment 1 1 comment reply Rahhul A commented Jul 12, 2023 reply Follow flag O(V^2) 0 0 replyShare Please log in or register to add a comment.
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).$ arungate answered Jul 13, 2023 arungate comment Share Follow 0 reply Please log in or register to add a comment.