If $|E| = Θ(|V|^2)$ would it be better to use an adjacency list or an adjacency matrix? I'm leaning towards adjacency matrix since the graph seems to be dense. Sorry for the basic question but can anyone please confirm?
2026-03-11 00:07:45.1773187665
$|E| = Θ(|V|^2)$ better to use adjacency matrix?
16 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
Both approaches will take a similar amount of memory ($\theta(n^2)$) but accessing a point in the adjacency matrix takes constant time while it takes linear time in the adjacency list so I would say that adjacency matrix would generally be better in this case