Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div 2 B
A flow network has source S and sink T, with directed arcs and capacities in brackets: S→D (1), S→B (6), C→B (9), D→A (9), D→T (8), B→D (4), B→A (5), B→T (6), A→T (6). What is the maximum flow from S to T?
- A. 6
- B. 7
- C. 8
- D. 2
Correct answer: B. 7
Edmonds–Karp (augmenting paths with residual capacities) gives maximum flow 7, which equals the minimum cut capacity. Sending along a single best path only carries 6; the total out of S is 7; 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 weighted graph has the arcs u→v (weight): Y→N (3), Y→E (9), Y→H (3), N→Y (3), N→E (4), N→H (7), E→N (15), E→A (11), H→Y (2)…
- An undirected graph has the vertices D, F, J, L, N, Y and the edges D–Y, Y–N, Y–J, N–F, F–J, J–L. In how many ways can each vertex be…
- A tree on the vertices F, I, P, S, T, W, Z has the arcs W→T, T→Z, W→S, W→F, P→T, P→I (each undirected edge is directed as shown). You may…
- Bellman–Ford is run from source J on the directed graph whose arcs (weights in brackets) are listed in the order they are relaxed: C→J…
- Each cell of a grid with 3 rows and 3 columns has an arrow: R = right, L = left, U = up, D = down. ULU LUR ULU From a cell you may move to…
- A tree has vertices A, D, E, J, L, Q, T, W, X and weighted edges (weights in brackets): L–T (2), T–D (6), D–W (9), T–Q (6), Q–J (7), L–X…