>
Exams
>
Computer Science & Information Technology
>
Computer Languages and Algorithms
>
what is the worst case time complexity of depth fi
Question:
What is the worst-case time complexity of depth first search of a graph with ‘V’ nodes and ‘E’ edges?
Show Hint
DFS uses \(O(V + E)\) because it traverses all nodes and adjacent edges.
TS PGECET - 2024
TS PGECET
Updated On:
May 26, 2025
\(O(V + E)\)
\(O(V)\)
\(O(E)\)
\(O(V \times E)\)
Show Solution
Verified By Collegedunia
The Correct Option is
A
Solution and Explanation
In DFS, each vertex and each edge is visited once in the worst case. Hence, the time complexity is \(O(V + E)\).
Download Solution in PDF
Was this answer helpful?
0
0
Top TS PGECET Computer Science & Information Technology Questions
The transition a pushdown automation made by is additionally dependent upon
TS PGECET - 2024
Computer Science & Information Technology
Theory of Computations
View Solution
Moore machine is an example of
TS PGECET - 2024
Computer Science & Information Technology
Theory of Computations
View Solution
For a machine to surpass all the letters of alphabets excluding vowels, how many states in DFA would be required?
TS PGECET - 2024
Computer Science & Information Technology
Theory of Computations
View Solution
A language $L$ is said to be Turing machine (TM) decidable if
TS PGECET - 2024
Computer Science & Information Technology
Theory of Computations
View Solution
A Turing machine that is able to simulate other Turing machines is known as
TS PGECET - 2024
Computer Science & Information Technology
Theory of Computations
View Solution
View More Questions
Top TS PGECET Computer Languages and Algorithms Questions
Given an array $A = \{15, 23, 27, 32, 45, 49, 60\}$ and key = 49, what are the mid values (corresponding array elements) in the first and second levels of recursion?
TS PGECET - 2024
Computer Science & Information Technology
Computer Languages and Algorithms
View Solution
What is the best case time complexity for linear search?
TS PGECET - 2024
Computer Science & Information Technology
Computer Languages and Algorithms
View Solution
How many solutions are there for the 8-Queen problem on an $8 \times 8$ chessboard?
TS PGECET - 2024
Computer Science & Information Technology
Computer Languages and Algorithms
View Solution
Which among the following is an external sorting technique?
TS PGECET - 2024
Computer Science & Information Technology
Computer Languages and Algorithms
View Solution
How many passes does an insertion sort algorithm take for sorting an array of ‘n’ elements?
TS PGECET - 2024
Computer Science & Information Technology
Computer Languages and Algorithms
View Solution
View More Questions
Top TS PGECET Questions
If \( P = \begin{pmatrix} 1 & 1 & 1 \\ 0 & 1 & 2 \\ 0 & 0 & 1 \end{pmatrix} \) is the modal matrix of \( A = \begin{pmatrix} 1 & 1 & 0 \\ 0 & 2 & 2 \\ 0 & 0 & 3 \end{pmatrix} \) then the sum of all the elements of \( P^{-1}AP \) is
TS PGECET - 2024
Matrices
View Solution
If the system of equations \( kx + y + z = k - 1 \), \( x + ky + z = k - 1 \), and \( x + y + kz = k - 1 \) has infinite solutions, then \( k \) is
TS PGECET - 2024
Linear Programming
View Solution
The value of the integral \( \int_C (2xy - x^2) \, dx + (x^2 + y^2) \, dy \) where \( C \) is the boundary of the region enclosed by \( y = x^2 \) and \( y^2 = x \), described in the positive sense, is
TS PGECET - 2024
Calculus
View Solution
Let \( f(x) = \log x \). The number \( C \) strictly between \( e^2 \) and \( e^3 \) such that its reciprocal is equal to \( \frac{f(e^3) - f(e^2)}{e^3 - e^2} \) is
TS PGECET - 2024
Calculus
View Solution
The solution of the differential equation \( (D^2 + 2)y = x^2 \) is
TS PGECET - 2024
Differential Equations
View Solution
View More Questions