Computer Science EngineeringHard
The time complexity of topological sorting of a DAG with V vertices and E edges using DFS is
- A. O(V^2 E)
- B. O(E log V)
- C. O(V log V)
- D. O(V + E)
Correct answer: D. O(V + E)
DFS visits each vertex and edge once.
Practise more Algorithms, Data Structures & Programming (ISRO CS) questionsAlgorithms, Data Structures & Programming (ISRO CS): notes and key points
More Algorithms, Data Structures & Programming (ISRO CS) questions
- Which of the following standard sorting algorithms is stable?
- In a max-heap, the largest element is always located at
- A simple undirected graph has 10 vertices and exactly 3 connected components. What is the maximum possible number of edges?
- How many distinct spanning trees does the complete graph K4 have?
- The best-case running time of insertion sort (already sorted input) is
- The recurrence T(n) = T(sqrt(n)) + 1 has the solution