GATE CS 2021 · Set-1 · Asymptotic Analysis & Recurrences

MSQ · 2 marks · Problem PROG-DIVC-0079

Define \(R_n\) to be the maximum amount earned by cutting a rod of length n meters into one or more pieces of integer length and selling them. For \(i > 0\), let \(p[i]\) denote the selling price of a rod whose length is \(i\) meters. Consider the array of prices:\(\text{p}[1]=1,\text{p}[2]=5,\text{p}[3]=8,\text{p}[4]=9,\text{p}[5]=10,\text{p}[6]=17,\text{p}[7]=18\)which of the following statements is/are correct about \(R_7\)?
  1. A
    \(R_7=18\)
  2. B
    \(R_7=19\)
  3. C
    \(R_7\) is achieved by three different solutions.
  4. D
    \(R_7\) cannot be achieved by a solution consisting of three pieces.

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solutionOfficial GATE Answer Key: A, C.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/357411/gate-cse-2021-set-1-question-40

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com