Data Structures & AlgorithmsVery hardICPC regional · tree queries
Problem: Which problem does the 'LCA by Euler tour and RMQ' reduce to?
- A. Shortest path with negative edges
- B. Bipartite matching
- C. Range minimum query over depths
- D. Topological sort
Correct answer: C. Range minimum query over depths
The Euler tour records depths, and the LCA is the minimum-depth vertex in the range between two first occurrences.
More Coding Interview Problems questions
- Problem: Which property does a 'matroid intersection' problem violate in general, making it harder than a single matroid?
- Problem: What is the time complexity of finding a minimum spanning tree in a complete graph with V vertices using Prim's algorithm and an…
- Problem: What does Fermat's little theorem let you compute efficiently?
- Problem: Which statement about the Bellman-Ford algorithm is correct when there is a negative cycle reachable from the source?
- Problem: What is the minimum number of colours needed to colour a bipartite graph so that no adjacent vertices share a colour?
- Problem: Which operation does the 'pointer jumping' technique speed up in parallel algorithms, and what is its complexity?