if you start from 0 on the number line and move 4 units to the right, making 3 such moves, which number do you reach ??????
plz help me in this question.
whose answer will be correct will be marked as brainliest....
Answers
Step-by-step explanation:
The important think to note is we can reach any destination as it is always possible to make a move of length 1. At any step i, we can move forward i, then backward i + 1.
Below is a recursive solution suggested by Arpit Thapar here.
1) Since distance of + 5 and – 5 from 0 is same, hence we find answer for absolute value of destination.
2) We use a recursive function which takes as arguments:
i) Source Vertex
ii) Value of last step taken
iii) Destination
3) If at any point source vertex = destination; return number of steps.
4) Otherwise we can go in both of the possible directions. Take the minimum of steps in both cases.
From any vertex we can go to :
(current source + last step +1) and
(current source – last step -1)
5) If at any point, absolute value of our position exceeds the absolute value of our destination then it is intuitive that the shortest path is not possible from here. Hence we make the value of steps INT_MAX, so that when i take the minimum of both possibilities, this one gets eliminated.
If we don’t use this last step, the program enters into an INFINITE recursion and gives RUN TIME ERROR.
Answer:
4×3=12
Step-by-step explanation:
Mark as BRAINLIEST