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?

  1. A. 325
  2. B. 300
  3. C. 280
  4. 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

Exams that ask this topic