Nitin Agarwal
Nitin Agarwal

Reputation: 43

For undirected graph, why memory requirement for adjacency list representation is θ(V+E) and not θ(V+2E) ?

In case of undirected graph, since there are 2E edges in the adjacency list representation then why the memory requirement is same as that for directed graph?

Upvotes: 1

Views: 202

Answers (1)

gue
gue

Reputation: 2028

Theta(V+E) = Theta(V+2E) since 2 is a constant and makes no difference in big-O notation.

Upvotes: 1

Related Questions