pls show all the work I will upvote, If you don't know pls don't copy the wrong answer
Posted: Tue Apr 12, 2022 10:25 am
pls show all the work I will upvote, If you don't know pls
don't copy the wrong answer
Let G be a directed graph on n vertices which is given as input by the adjacency matrix V[1...n]1 ...n]. Develop an O(n)-time algorithm to check if there is any vertex in G that has edges coming to it from all other vertices of G but no edges going out from it. Justify why your algorithm runs in O(n) time.
don't copy the wrong answer
Let G be a directed graph on n vertices which is given as input by the adjacency matrix V[1...n]1 ...n]. Develop an O(n)-time algorithm to check if there is any vertex in G that has edges coming to it from all other vertices of G but no edges going out from it. Justify why your algorithm runs in O(n) time.