Try Khov
May 9, 2022

--

Hi Ferdous,

I just realized that there's been another mistake and that my original space complexity of O(V + E) was correct. The reason is that each node has a certain number of edges.

Each node has an array that keeps track of its neighbors (edges). Since there are a total of E edges and a total of V nodes, the space complexity is ultimately O(V + E).

--

--

Try Khov
Try Khov

Written by Try Khov

Engineer turned writer. Language nerd.

No responses yet