GateAI
Algorithm Design Techniques

GATE CSE 2014 Set 3 · Q37

NAT2 marksEasy

Time

Suppose you want to move from 0 to 100 on the number line. In each step, you either move right by a unit distance or you take a *shortcut*. A shortcut is simply a pre-specified pair of integers i,ji, j with i<ji < j. Given a shortcut i,ji, j if you are at position ii on the number line, you may directly move to jj. Suppose T(k)T(k) denotes the smallest number of steps needed to move from kk to 100. Suppose further that there is at most 1 shortcut involving any number, and in particular from 9 there is a shortcut to 15. Let yy and zz be such that T(9)=1+min⁡(T(y),T(z))T(9) = 1 + \min(T(y), T(z)). Then the value of the product yzyz is _______.

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 150

Algorithm Design Techniques

From position 99, the two possible valid moves are:

  1. Moving right by a unit distance to position 9+1=109 + 1 = 10, which takes 1+T(10)1 + T(10) steps to reach 100100.

  2. Taking the shortcut directly from 99 to 1515, which takes 1+T(15)1 + T(15) steps to reach 100100.

Hence, the optimal number of steps from position 99 is:

T(9)=1+min⁡(T(10),T(15))T(9) = 1 + \min(T(10), T(15))

Comparing this with the given equation T(9)=1+min⁡(T(y),T(z))T(9) = 1 + \min(T(y), T(z)), the set of positions is {y,z}={10,15}\{y, z\} = \{10, 15\}.

The product of yy and zz is:

yz=10×15=150yz = 10 \times 15 = 150

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Algorithm Design Techniques previous year question is Q37 of the GATE CSE 2014 Set 3 paper. Find more GATE CSE PYQs on Algorithm Design Techniques in Algorithms, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Algorithm Design Techniques PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Algorithm Design Techniques in GATE CSE

Algorithm Design Techniques has 6 GATE CSE PYQs across 6 papers from 2011 to 2017. 3 of them are 2-mark NAT questions like this one, and it is the only one in GATE CSE 2014 Set 3.

How GATE tests Algorithm Design Techniques

More from GATE CSE 2014 Set 3

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2014 Set 3 · Q37 · NAT

Suppose you want to move from 0 to 100 on the number line. In each step, you either move right by a unit distance or you take a *shortcut*. A shortcut is simply a pre-specified pair of integers i, j with i < j. Given a shortcut i, j if you are at position i on the number line, you may directly move to j. Suppose T(k) denotes the smallest number of steps needed to move from k to 100. Suppose further that there is at most 1 shortcut involving any number, and in particular from 9 there is a shortcut to 15. Let y and z be such that T(9) = 1 + min(T(y), T(z)). Then the value of the product yz is …

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.