What is the time complexity for searching an element in a graph?
2025
What is the time complexity for searching an element in a graph?
- A.
O(1)
- B.
O(n)
- C.
O(log n)
- D.
O(n^2)
Attempted by 183 students.
Show answer & explanation
Correct answer: B
The time complexity for searching an element in a graph is O(n), where 'n' is the number of vertices in the graph.