### Help with a question?

Hey all, some im stuck with a problem that im trying to program. Any help with what it would look like is greatly appreciated:

Problem 2: The jumping game
Consider an array of size
n
that contains integers in the range [0
, n

1]. Such an
array will represent a jumping game as follows. We first read
a
[0]. If
a
[0] =
i
,
a
[
i
]. If
a
[
i
] =
j
a
[
j
], and so on. We repeatedly do this until
we read a 0. This is when the jumping game terminates. However, there is a
possibility that the game will never terminate.
Example 1: if the array is [1,3,4,2,0] then:
a[0]=1
a[1]=3
a[3]=2
a[2]=4
a[4]=0 terminates
Example 2: if the array is [1,3,3,2,0] then:
a[0]=1
a[1]=3
a[3]=2
a[2]=3
a[3]=2
. . . it will never terminate
(a) Write a function called terminate that takes an array and its length as pa
-
rameters and returns true if the jumping game on this array will terminate,
and false otherwise. Your function is not allowed to change the array or use an
auxiliary array.
(b) Write a function called terminate that takes as parameter an array the size
of which is unknown (the length is not passed as a parameter), and returns true
if the jumping game on this array will terminate, and false otherwise. This t
ime,
your function is allowed to change the array.
In both cases, if the jumping game does not terminate, your function is not
supposed to run indefinitely
Please note, that this is not a homework site. We won't do your homework for you. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.

We didn't see your attemts to solve this problem youself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again. As it is impossible to find deriviative of function without knowledge in ariphmetics, you cannot do more complex tasks in programming without clear understanding of basics
Topic archived. No new replies allowed.