The Gateway to Computer Science Excellence
0 votes
21 views
Given an adjacency-list representation of a directed graph, how long does it take to compute the out-degree of every vertex ? How long does it take to compute the in-degrees ?
in Algorithms by Boss (41.9k points) | 21 views

1 Answer

0 votes
To compute the out degree each vertex we would need $O(V+E)$.

To compute the in degree we have to scan through adjacency lists and count how many times each vertex has appeared. This is $O(V+E)$
by (269 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,644 questions
56,516 answers
195,578 comments
101,130 users