Data Structures & AlgorithmsModerateICPC regional · shortest path
Problem: Which statement about the Floyd-Warshall algorithm's memory usage for V vertices is correct?
- A. O(V^3) because each k needs a new matrix
- B. O(E) only
- C. O(1) because the answer is printed
- D. O(V^2), one matrix updated in place
Correct answer: D. O(V^2), one matrix updated in place
The in-place update uses a single V x V matrix, so the memory is O(V^2).
More Coding Interview Problems questions
- Problem: Which problem asks for the minimum number of edges to add to make a graph 2-edge-connected?
- Problem: What does 'lazy propagation' in a segment tree guarantee for a range-add update?
- Problem: Which result is the basis of Mo's algorithm's complexity analysis?
- Problem: What is the expected number of comparisons of randomised quicksort on n distinct elements?
- Problem: Which property does the 'exchange argument' prove for an optimal greedy algorithm?
- Problem: Which structure supports both insertion and 'k-th smallest' queries in O(log n) each?