Aa N.

asked • 02/11/17

recursive algorithum

Examine the following recursive method.
public int mystery(int x, int y)
{
if (x < y)
{ return 0; }
else
{ return 1 + mystery(x – y, y); }
}
(a) State the value of variable w after
(i) int w = mystery(2, 3); [1 mark]
(ii) int w = mystery(2, 2); [1 mark]
(iii) int w = mystery(7, 3). [1 mark

1 Expert Answer

By:

Stanton D. answered • 02/11/17

Tutor
4.6 (42)

Tutor to Pique Your Sciences Interest

Aa N.

sorry the 1 mark is mark allotted to that part of question
this question from my school exam I am studying ib diploma computer science higher level
Report

02/12/17

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.