1.

On which of the following statements does the time complexity of checking if an edge exists between two particular vertices is not, depends?(a) Depends on the number of edges(b) Depends on the number of vertices(c) Is independent of both the number of edges and vertices(d) It depends on both the number of edges and verticesAsked question is from Adjacency Matrix topic in division Graph of Data Structures & Algorithms IThe question was asked by my college professor while I was bunking the class.

Answer» CORRECT option is (c) Is independent of both the NUMBER of edges and vertices

Explanation: To CHECK if there is an EDGE between to vertices i and j, it is enough to see if the value of A[i][j] is 1 or 0, here A is the adjacency matrix.


Discussion

No Comment Found

Related InterviewSolutions