The Gateway to Computer Science Excellence
0 votes
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 | 37 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)$

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
52,375 questions
60,586 answers
95,409 users