Data Structures & AlgorithmsHardCodeforces Div 2 C · GATE CS
A flow network has source S and sink T, with directed arcs and capacities in brackets: S→A (5), S→D (9), S→T (7), E→C (2), E→D (2), E→T (1), C→D (2), A→C (9), A→D (7), A→T (5), D→A (6), D→T (2). What is the maximum flow from S to T?
- A. 3
- B. 7
- C. 15
- D. 14
Correct answer: D. 14
Edmonds–Karp (augmenting paths with residual capacities) gives maximum flow 14, which equals the minimum cut capacity. Sending along a single best path only carries 7; the total out of S is 21; and minimising the number of cut arcs (ignoring capacity) gives 3.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- An undirected graph has the vertices D, L, N, R, X, Z and the edges N–L, Z–X, X–L, Z–D, L–R, Z–L, Z–N. How many simple cycles does it…
- An undirected graph has the vertices A, J, L, Q, W, X, Y and the edges L–J, L–X, L–W, L–A, Q–X, Q–A, J–Y, Y–W. What is the size of a…
- A pile holds p stones. In one move a player removes exactly s stones, where s is one of {1, 2, 4} and s ≤ the pile size. The player who…
- An undirected graph has the vertices F, J, K, M, S, T, V, X and the edges J–V, J–X, J–F, J–M, J–K, V–F, V–S, X–F, X–M, X–K, F–K, S–M. What…
- An undirected graph has the vertices A, J, K, L, O, Q, X, Y and the edges J–Q, J–Y, J–A, J–O, Q–L, Q–X, K–L, K–O. What is the size of a…
- An undirected graph has the vertices C, E, H, K, M, N, T, Y and the edges E–M, E–N, E–Y, E–T, C–N, C–H, C–Y, C–T, M–N, M–K, N–K, Y–T. What…