Can anyone explain to me why the space complexity of adjacency lists is Theta(m + n)?
Example graph:
a: b, c, d
b : e
c : d, e
d : empty
e : a
So here n = 5, m = 7.
Even crazier: The professor told us about a space complexity of Theta(m * log_2(n))
Let's look at Theta(m + n) ... there are constants c1 and c2 satisfying c1 * (m + n) <= space_complexity_of_this <= c2 * (m + n) ... but what if we have |E| = n choose 2 (maximum number of edges), then our space complexity would be something like n * (n - 1) and that doesn't fit c2.