Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 2 Lnai 6322

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215882X, 978-3642158827

More Books

Students also viewed these Databases questions

Question

Define Management by exception

Answered: 1 week ago

Question

Explain the importance of staffing in business organisations

Answered: 1 week ago

Question

What are the types of forms of communication ?

Answered: 1 week ago

Question

Explain the process of MBO

Answered: 1 week ago