# GATE2014-3-37

4.8k views

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 \:\text{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 _____.

edited

$T(k)$ is the smallest number of steps needed to move from $k$ to $100$.

Now, it is given that $y$ and $z$ are two numbers such that,

$T(9) = 1 + \min (T(y), T(z))$ , i.e.,

$T(9) = 1 + \min ($Steps from $y$ to $100$, Steps from $z$ to $100)$, where $y$ and $z$ are two possible values that can be reached from $9$.

One number that can be reached from $9$ is $10$, which is the number obtained if we simply move one position right on the number line. Another number is $15$, the shortcut path from $9$, as given in the question. So, we have two paths from $9$, one is $10$ and the other is $15$.

Therefore, the value of $y$ and $z$ is $10$ and $15$ (either variable may take either of the values).

Thus, $yz = 150$.

edited
0
nice
0
what a nice approach @Regina phalange
0

""T(9)=1+min(T(9)=1+min(Steps from yy to 100100, Steps from zz to 100)100), where y and z are two possible values that can be reached from 9." Where  it is mentioned???

0

0

I am unable to find out how it,"where y and z are two possible values that can be reached from 9", is linked. Can you please explain where it is ?

6

T(9)=1+min(T(y),T(z))

here the 1 in the equation is telling that. Equation says calculate minimum of T(y) and T(z) and then simply add 1 to it. What does that mean? 9 is at a distance of 1 from both y and z.

Analogy : height of the tree is : 1 + height(left) + height (right). Why one is here? because root is at distance one from both right and left.

$T(9) =$ Distance from $9$ to $100$
$T(9)=1+ \min(T(y),T(z))=1+$min(Distance from $y$ to $100$ , Distance from $z$ to $100$)

There are only two such values where we can reach from $9$ , one is simple step to right on number line , i.e $10$ and another is $15$ (given shortcut)

Hence , $y=10$ , $z=15$
$yz=10 \times 15 = 150$

edited by
0
Can you please explain this question once again , I am not getting it precisely .
0
I am not getting .. Please explain anyone
2

it is solved like this

T(1)=1+min(T(y),T(z))=1+1=2

T(2)=1+min(T(y),T(z))=1+2=3

T(3)=1+min(T(y),T(z))=1+3=4

.

.

.

T(9)=10

Now, shortcut for T(9)=15

So, yz=10*15=150

but how could it be say , it goes from 0 to 100?

4
Solution of the equation

T(9)=1+min(T(y),T(z))

Now, 9 to 15 there is a shortcut.

Now, if I take solution like that

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

=1+T(15)

that means , T(9) to T(15) there exists 1 step, i.e. why we are adding 1. From $k$, we have two paths-

1. Path 1- This is the path where we go from $k$ to $k_1$ where $k_1 = k+1$. Here, $k_1$ is the next number to the right of $k$.
2. Path 2- This is the path where we go from $k$ to $k_2$ where $k_2 = k+i$. Here, $k_2$ is the the number to which $k$ has a shortcut.

Therefore, we have the following recurrence relation-

$T(k) = 1 + min(T(k_1), T(k_2))$

This basically means that the smallest no. of steps from $k$ to $100$ includes at least one step (either from $k$ to $k_1$ or from $k$ to $k_2$) and then subsequent smallest no. of steps from either $k_1$ to $100$ or from $k_2$ to $100$, whichever is minimum.

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

Here,

$k_1 = 9+1 = 10 \Rightarrow y = 10$,

$k_2 = 15$ ,($\because$ there is at most a single shortcut involving any number and it is given that the shortcut from $9$ is $15$) $\Rightarrow z = 15$

$\therefore y.z = 10.(15) = 150$

edited
0

@Debargha Bhattacharj

• Suppose, if another shortcut is from (11,100), then also, we would take T(10) and T(15).

As 11 can go only  from 10, not from 9.

right??

• And Ans couldnot be  T(9) and T(15), because, T(9) has only one shortcut. No, more shortcut possible from T(9)

right??

1
• And Ans couldn't be  T(9) and T(15), because, T(9) has only one shortcut. No, more shortcut possible from T(9), right?

It is mentioned that there can be at most 1 shortcut involving any number.

• Suppose, if another shortcut is from (11,100), then also, we would take T(10) and T(15).

As 11 can go only  from 10, not from 9.

right??

Not necessarily. It is mentioned that a shortcut is present at 9 which takes us to the number 15. Therefore, we can decide to go from 9 to 10 or from 9 to 15.

Suppose we chose the first path, i.e. we went from 9 to 10. Now, from 10, there is no shortcut, i.e. we can go to 11 only. This is possible because not every number needs to have a shortcut. From 11, we have two paths-

• Path 1-11 to 12 (usual path)
• Path 2-11 to 100 (shortcut path)]

Therefore, we have-

T(9) = 1 + min[T(10), T(15)]

T(10) = 1 + T(11)

T(11) = 1 + min[T(12), T(100)]

0

@Debargha Bhattacharj

what is meaning of 1+

in the expression T(9) = 1 + min[T(10), T(15)]

0

@srestha

See, from number $9$, we can go to either number $10$ (immediate successor) or number $15$ (shortcut successor).

Now, irrespective of the successor we finally choose, we already have one path- either $9 \rightarrow 10$ or $9 \rightarrow 15$. Hence the $1 \ +$.

0

So, from 1 to 9 , there is no path??

Question is

want to move from 0 to 100 on the number line

right?

0

@Debargha Bhattacharj

Another question

Suppose, we want to find the function $T(9) = 1 + \min(T(y),T(z))$

then what will be ur answer?

0

@srestha

No. Even if there might not be any shortcut paths for the numbers ${0, 1, 2, \dots 8}$, yet there is at least one path which is guaranteed to exist. That path is-

$0 \rightarrow 1 \rightarrow 2 \rightarrow \dots \rightarrow 8 \rightarrow 9$

The given question is simply asking us to determine what will be the value of the variables $y$ and $z$ when we consider the paths from $9$. We don't need to consider the preceding paths that we might have followed to reach $9$.

0

@srestha

Suppose, we want to find the function T(9)=1+min(T(y),T(z))T(9)=1+min(T(y),T(z))

then what will be ur answer?

We will calculate $T(y)$ and $T(z)$, which, in this case, is $T(10)$ and $T(15)$.

Now, depending on which one (out of $T(10)$ and $T(15)$) has the minimum vale, we will substitute $T(9) = 1 + min(T(10), T(15))$ by either $T(9) = 1 + T(10)$ if $T(10)$ has minimum value; or by $T(9) = 1 + T(15)$ if $T(15)$ has minimum value

In order to find $T(10)$ and $T(15)$, we can use the same formula that is used to find $T(9)$ by using the appropriate values. In other words,

$T(10) = 1 + min(T(11), T(a))$, (assuming there is a shortcut from 10 to some number a)

Similarly, $T(15) = 1 + min(T(16), T(b))$, (assuming there is a shortcut from 15 to some number b)

## Related questions

1
7k views
Consider two strings $A$="qpqrr" and $B$="pqprqrp". Let $x$ be the length of the longest common subsequence (not necessarily contiguous) between $A$ and $B$ and let $y$ be the number of such longest common subsequences between $A$ and $B$. Then $x +10y=$ ___.
There are two elements $x,\:y$ in a group $(G,*)$ such that every element in the group can be written as a product of some number of $x$'s and $y$'s in some order. It is known that $x*x=y*y=x*y*x*y=y*x*y*x=e$ where $e$ is the identity element. The maximum number of elements in such a group is ____.
Let $S$ be a sample space and two mutually exclusive events $A$ and $B$ be such that $A \cup B = S$. If $P(.)$ denotes the probability of the event, the maximum value of $P(A)P(B)$ is_____.