| preferred AP College board partner for AP classes
hard Solved by 4 students
Recursive Multiplication Algorithm
< Prev
Next >

Consider the following recursive function.

function mystery(x, y)
{
 if (y == 0)
   return 0;
 else if (y % 2 == 0)
   return mystery(x + x, y / 2);
 else
   return x + mystery(x + x, (y - 1) / 2);
}

What mathematical operation is performed by the call mystery(x, y)?

A

Integer division of x by y

B

Exponentiation (x raised to power y)

C

Multiplication of x and y

D

Logarithm of y with base x

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1djy18102311 1m 29s 11
#2jasonvikathompson12 1m 29s 1
#3jdvillalta86515 1m 57s -57
Items per page:
10
1 – 3 of 3
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy