1.

Time complexity to check if an edge exists between two vertices would be ___________(a) O(V*V)(b) O(V+E)(c) O(1)(d) O(E)My doubt is from Incidence Matrix and Graph Structured Stack topic in portion Graph of Data Structures & Algorithms IThis question was posed to me during an online interview.

Answer»

The CORRECT ANSWER is (d) O(E)

Best explanation: We have to check for all edges, in the worst CASE the vertices will have no common edge.



Discussion

No Comment Found

Related InterviewSolutions