Engineering-Mathematics
October 5, 2023
Data-Structures
October 5, 2023
Engineering-Mathematics
October 5, 2023
Data-Structures
October 5, 2023

Data-Structures

Question 59

The most efficient algorithm for finding the number of connected components in an undirected graph on n vertices and m edges has time complexity

A
θ(n)
B
θ(m)
C
θ(m+n)
D
θ(mn)
Question 59 Explanation: 
To find the number of connected components using either BFS or DFS time complexity is θ(m+n).
Suppose if we are using Adjacency matrix means it takes θ(n2).
Correct Answer: C
Question 59 Explanation: 
To find the number of connected components using either BFS or DFS time complexity is θ(m+n).
Suppose if we are using Adjacency matrix means it takes θ(n2).
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!