GATE Computer ScienceVery hardGATE CS (PYQ pattern)
A stick of length 100 must be cut at positions 20, 35, 50, 70 and 85 (in any order). Each cut costs the length of the piece being cut. What is the minimum total cost?
- A. 325
- B. 300
- C. 280
- D. 260
Correct answer: D. 260
Interval DP over the sorted cut points: cost(i, j) = (p_j − p_i) + min over k of cost(i, k) + cost(k, j), giving 260. Cutting left to right in the listed order costs 100 + 80 + 65 + 50 + 30 = 325.
More Algorithms questions
- Balloons with numbers [3, 1, 5, 8, 2, 6] are burst one at a time. Bursting a balloon with neighbours l and r (a missing neighbour counts…
- A directed graph has edges A→B 3, B→C −2, C→D 4, A→C 6, A→D 12, D→E 1, C→E 7, B→E 9. What is the length of the shortest walk from A to E…
- Borůvka's algorithm is run on the graph with edges (weights) 0-1 (7), 0-3 (5), 1-2 (8), 1-3 (9), 1-4 (10), 2-4 (6), 3-4 (15), 3-5 (11)…
- A weighted undirected graph on vertices 0–6 has edges (weight) 0-1 7, 0-3 5, 1-2 8, 1-3 9, 1-4 10, 2-4 6, 3-4 15, 3-5 11, 4-5 12, 4-6 13…
- How many satisfying assignments does the formula (x₁ ∨ x₂) ∧ (¬x₁ ∨ x₃) ∧ (¬x₂ ∨ ¬x₃) ∧ (x₂ ∨ x₄) ∧ (¬x₄ ∨ x₃) ∧ (x₁ ∨ ¬x₄) have over the…
- A topological order of the DAG with edges A→B, A→C, B→D, C→D, C→E, D→F, E→F, E→G, G→F, H→C, H→G is produced by running DFS (roots in…