CS130-lecture-20201125

IMAGE IMAGE IMAGE IMAGE

Answer: ( \frac{2E}{V}) avg number of degree.

IMAGE IMAGE IMAGE

If you have V, no self loop, no parallel edges, what is maximum edges?

Answer: ( \frac{V(V-1)}{2} )

So if you have (V), considered sparse.

IMAGE IMAGE

Adjacency lists represent each edge twice, so the number of spaces taken (number of nodes) is (2E). So the full space used by this is (V + 2E), so our space complexity is O(E + V).

IMAGE

  1. (V - 1)

IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE

Depth-first search trace on whiteboard:

IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE IMAGE

Count) worst case runtime.

Back to the analysis of the algorithm:

IMAGE

Worst case space is from a linear graph: IMAGE