Question
I need help with the following in C: Suppose you are playing a special game of hopscotch on a line of integer numbers drawn on
I need help with the following in C:
Suppose you are playing a special game of hopscotch on a line of integer numbers drawn on the ground like so:
4, 4, 1, 5, 2, 6, 3, 4, 2, 0
The number, with a square around it, indicates where you are currently standing. You can move left or right down the line by jumping the number of spaces indicated by the number you are standing on. So if you are standing on a 4, you can jump either left 4 spaces or right 4 spaces. *BUT: You cannot jump past either end of the line.
For example, the first number (4) only allows you to jump right, since there are no numbers to the left that you can jump to.
The goal: you want to get to the 0 at the far end (right side) of the line. You are also guaranteed that there will be only one zero, which, again, will be at the far right side.
Some lines have multiple paths to 0 from the given starting point. Other lines have no paths to 0, such as the following:
3 1 2 3 0
In this line, you can jump between the 3's, but not anywhere else.
You are to write a recursive function that returns an integer 1 (for solvable) or 0 (for not solvable), indicating if you are able to get to the rightmost 0 or not.
There needs to a wrapper function of: void functionName(FILE *fin, FILE *fout)
Example of input file: functionName 0 8 2 3 4 6 3 5 2 0
Example of output file: functionName: Solvable
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started