retagged by
2,616 views

1 Answer

Best answer
5 votes
5 votes
  1. Consider the given Graph and its Adjacency list.

  1. Procedure to fill Adjacency list apply BFS algorithm. On every vertex will give you all vertex which are directly connected to That vertex. which take O(m+n) time .
  2. Now if i want to find in-degree of any vertex then just go to that vetrex and go to corresponding row to that vertex which will take O(n+m) time in worst case .
selected by

Related questions