Question: 5 1 0 4 2 3 0 1 2 3 4 5 a 1 . a is a list of 'int' 2 . Length of
a
a is a list of 'int'
Length of list a is NOT known. YOU CANNOT CALL lena
If the length of the list is as shown above
the content of the array is guaranteed to be between to
THERE IS NO REPETATION of numbers
a ;
int h hopa;
Your task is to find the number of hops to get which is defined as follows:
The top level call is as follows:
a
a
a
a
a
h Number of hop is
You start from ax in this case x a and keep looping
until you get x which is The number of times you hoped, in this example, is h
One way, to write, using while loop is:
Now write "hop" subroutine as follows:
You cannot change interface of hop function
You cannot use globalstatic variables
You cannot use any loop statements
like while, do for and goto
You cannot call any function except hop
Your code should not be more than lines
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
