Which statement about adjacency matrix and adjacency list space usage is true for a graph with V vertices?

Prepare for the GATE General Aptitude and CS Test. Enhance your skills with multiple choice questions and detailed explanations. Elevate your readiness and boost your confidence for the exam!

Multiple Choice

Which statement about adjacency matrix and adjacency list space usage is true for a graph with V vertices?

Explanation:
The main idea is how memory scales with the number of vertices and edges in different graph representations. An adjacency matrix reserves space for every possible pair of vertices, so it always uses space proportional to V^2. You store a value (often 0/1) for each pair, regardless of how many edges actually exist. An adjacency list, on the other hand, keeps a separate list of neighbors for each vertex. The total amount of storage then grows with the number of vertices plus the number of edges, giving O(V + E). For sparse graphs (few edges), this is much smaller than V^2. For dense graphs (many edges), E approaches V^2 and the list’s space also becomes on the order of V^2, though the constants differ.

The main idea is how memory scales with the number of vertices and edges in different graph representations. An adjacency matrix reserves space for every possible pair of vertices, so it always uses space proportional to V^2. You store a value (often 0/1) for each pair, regardless of how many edges actually exist. An adjacency list, on the other hand, keeps a separate list of neighbors for each vertex. The total amount of storage then grows with the number of vertices plus the number of edges, giving O(V + E). For sparse graphs (few edges), this is much smaller than V^2. For dense graphs (many edges), E approaches V^2 and the list’s space also becomes on the order of V^2, though the constants differ.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy