Adjacency Matrix , When?

When to use Adjacency Matrix ? -> If two nodes connected or not TC - O(1) If we do it by adjacency list or edge list we have to use loop . The complexity will become O(N) .

Mar 10, 2025 - 10:36
 0
Adjacency Matrix , When?

When to use Adjacency Matrix ?
-> If two nodes connected or not
TC - O(1)
If we do it by adjacency list or edge list we have to use loop . The complexity will become O(N) .