Data Structures & AlgorithmsVery hardICPC regional · MST applications
Problem: Consider a graph where you must find the minimum 'maximum edge' on a path from s to t (a bottleneck path). Which algorithm computes it correctly and efficiently?
- A. Kruskal's MST, then the maximum edge on the MST path from s to t
- B. Dijkstra with edge weights summed along the path
- C. Floyd-Warshall with multiplication of weights
- D. Topological sort on the weights
Correct answer: A. Kruskal's MST, then the maximum edge on the MST path from s to t
The minimax path lies on the MST, so the answer is the heaviest edge on the MST path between s and t. Summing weights (Dijkstra) answers a different problem.
More Coding Interview Problems questions
- Problem: For a segment tree with n leaves supporting range-sum queries and point updates, what is the total space needed in terms of n?
- Problem: Find the number of inversions in [5, 4, 3, 2, 1] that a merge-sort based counter would report. Run the code. python def count(a)…
- Problem: Which claim about the Knuth-Morris-Pratt algorithm is correct?
- Problem: A player picks a number from 1 to 10 and the other player must guess it by yes/no questions. The minimum worst-case number of…
- Problem: What is the complexity of computing all prefix XOR values of an array of n = 10^6 integers and then answering q = 10^6 range-XOR…
- Problem: Consider a DP over subsets for assigning n jobs to n workers (cost matrix given), with state = mask of assigned jobs and…