Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
A flow network has source S and sink T, with directed arcs and capacities in brackets: S→A (9), D→T (3), A→D (1), A→T (4), B→D (4), B→T (3). What is the maximum flow from S to T?
- A. 4
- B. 5
- C. 6
- D. 9
Correct answer: B. 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 4; the total out of S is 9; and minimising the number of cut arcs (ignoring capacity) gives 1.
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 D, G, K, L, Q, S, V, Y and the directed edges D→K, D→Q, D→L, D→V, Q→L, G→L, D→Y, Y→Q, K→Y, K→V…
- A tree has vertices F, G, J, K, L, M, N, U, X and weighted edges (weights in brackets): N–F (4), N–U (3), U–M (7), N–X (7), U–J (7), U–K…
- Bellman–Ford is run from source I on the directed graph whose arcs (weights in brackets) are listed in the order they are relaxed: O→I…
- A counter starts at 1. Each step, you may add 1, add 2, or double the counter. Each step must stay at or below 12. Two sequences of steps…
- Consider this recursive function: python def f(n): if n <= 1: return f(n - 2) if n % 3 == 0: f(n - 2) How many times is f called in total…
- An undirected graph has the vertices J, K, M, O, P, Y and the edges P–M, P–Y, P–O, P–K, P–J, M–Y, M–O, Y–K, O–K. What is its chromatic…