Data Structures & AlgorithmsHardICPC regional · graph theory
Problem: What is the time complexity of finding the articulation points and bridges together with one DFS?
- A. O(V^2)
- B. O(E log E)
- C. O(E^2)
- D. O(V + E)
Correct answer: D. O(V + E)
A single DFS computes discovery times and low values, which identify both bridges and articulation points in linear time.
More Coding Interview Problems questions
- Problem: How many pairs (i < j) of integers in [1, 30] have i + j divisible by 6? Run the code. python print(sum(1 for i in range(1, 31)…
- Problem: How many integers in [1, 10000] are divisible by 9 but not by 27? Run the code. python print(sum(1 for x in range(1, 10001) if x…
- Problem: How many trailing zero bits (factors of 2) does 1000! have? Run the code. python n = 1000 c = 0 p = 2 while p <= n: c += n // p p…
- Problem: How many distinct values does (i j) mod 7 take for 1 <= i, j <= 7? Run the code. python print(len({(i j) % 7 for i in range(1, 8)…
- Problem: What is the maximum sum of non-adjacent elements of the circular array [3, 2, 7, 10]? Run the code. python def lin(a): inc = exc…
- Problem: How many palindromes of length 4 can be formed over the alphabet {a, b}? Run the code. python from itertools import product…