题目
题目

XLMC0202501 Topic 20 Quiz

单项选择题

Suppose a graph data structure is used to represent direct travel links between cities.   Nodes in the graph represent cities and there is an undirected edge from city X to city Y if it is possible to travel directly between those two cities.    If the primary use of this graph is to query whether direct travel between two cities is possible, which graph data structure would be more efficient in terms of the time required to complete the query?    

选项
A.Adjacency Matrix
B.Adjacency List
查看解析

查看解析

标准答案
Please login to view
思路分析
When assessing which graph representation yields faster queries for direct connectivity between two cities, we should compare how each structure supports edge existence checks. Option: Adjacency Matrix - In an adjacency matrix, edge presence between any two nodes can be checked in constant time by inspecting the entry at matrix[u][v]. For an undirected graph, matrix[u][v......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

类似问题

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!