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→D (9), S→A (2), S→B (9), S→T (3), A→D (7), A→T (8). What is the maximum flow from S to T?
- A. 23
- B. 2
- C. 5
- D. 6
Correct answer: C. 5
Edmonds–Karp (augmenting paths with residual capacities) gives maximum flow 5, which equals the minimum cut capacity. Sending along a single best path only carries 3; the total out of S is 23; and minimising the number of cut arcs (ignoring capacity) gives 2.
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
- A directed acyclic graph has the vertices C, F, K, Q, S, V, W and the directed edges Q→C, V→W, F→C, K→F, V→Q, S→Q, W→F, K→S, K→C, S→C. How…
- An undirected graph has the vertices H, K, N, T, U, X and the edges X–H, X–U, X–K, H–K, N–T, N–U, N–K, U–K. What is its chromatic number…
- Consider this function: python def g(n): if n < 3: return n if n % 2 == 0: return g(n - 3) + g(n - 3) return g(n - 1) - 1 What value does…
- A four-wheel combination lock shows four digits 0–9 on wheels that wrap around (9 goes to 0 and 0 goes to 9). One move turns one wheel by…
- A tree has vertices D, I, K, N, O, R, T, Y and weighted edges (weights in brackets): Y–T (4), Y–I (2), Y–O (8), Y–K (3), O–N (5), O–R (7)…
- An undirected graph has the vertices C, O, Q, W, X, Z and the edges X–Q, Q–C, Q–O, W–C, X–C, O–Z, Q–Z, C–O, X–Z. What is the minimum…