Question: Restriction: 1.Cannot use any static variable, can use many local variable 2.Cannot use any loop statements, can use if 3.After the execution of the routine

Restriction:
1.Cannot use any static variable, can use many local variable
2.Cannot use any loop statements, can use if
3.After the execution of the routine array, s must have the same contents as you got it.
4.The code cannot be more than 10 lines
HOP 0 1 2 3 4 5 s 510423 1. s is an integer array 2. Length of the array is NOT given. YOU CANNOT USE a.length 3. If the length of the array is 6 (as shown above) the content of the array is guaranteed to be between 0 to 5. THERE IS NO REPETATION of numbers The top level call is as follows: int a[6] = {5,1,0,4,2,3); int y = hopSmart (a, 3); Your task is to find the number of hops to get 3, which is defined as follows: until you get x, which is 3. The number of times you hoped, in this example, is y a a[3] = 4 = 2 a[2] = 0 a[0] = 5 a[5] = 3 y = Number of hop is = 4 to write reine while loon ie. no way
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
