+1 vote
in Data Structures & Algorithms I by (88.2k points)
The topological sorting of any DAG can be done in ________ time.

(a) cubic

(b) quadratic

(c) linear

(d) logarithmic

I'm obligated to ask this question of Directed Acyclic Graph topic in division Graph of Data Structures & Algorithms I

This question was addressed to me during an interview.

1 Answer

+1 vote
by (737k points)
selected by
Best answer
The correct choice is (c) linear

To explain: Topological sorting can be done in O(V+E), here V and E represents number of vertices and number of edges respectively.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.