Data Structures & AlgorithmsHardICPC regional · graph theory
Problem: Which algorithm constructs an Euler circuit of a connected graph whose vertices all have even degree in linear time?
- A. Kruskal's algorithm
- B. Dijkstra's algorithm
- C. Hierholzer's algorithm
- D. Tarjan's SCC algorithm
Correct answer: C. Hierholzer's algorithm
Hierholzer's algorithm splices sub-circuits found by walking greedily, which runs in O(V + E).
More Coding Interview Problems questions
- Problem: What is the time complexity of computing the Z-array of a string of length n?
- Problem: Which deterministic algorithm finds the global minimum cut of an undirected weighted graph with V vertices in O(V^3) time?
- Count the non-empty subarrays of a = [3, -1, 4, -1, 5, -9, 2, 6] whose sum is divisible by 5, using prefix sums taken modulo 5. python…
- Items (weight, value) are (5,10), (4,7), (6,12), (3,4) and the knapsack capacity is 10. Each item may be taken at most once. Run the exact…
- Binary string s = "1101001110001011". Find the length of the longest contiguous substring that contains equally many 0s and 1s. python…
- Intervals (start, end) are compatible when one ends at or before the other starts. Run the earliest-finish greedy on the list below and…