- Determine what the following pseudocode would print if thefunction mystery were run on the input [91, 54, 23]:
function mysteryHelper(A, b):
print ‘helper called with ‘ + A + ‘, ‘+ b
if b is less than the size of A:
c = A[b] -mysteryHelper(A, b + 1)
print ‘returning ‘+ c
return c
print ‘returning base case 0’
return 0
function mystery(A):
return mysteryHelper(A, 0)
- Give an example of a problem for which recursion is anappropriate solution. Justify your answer.
- Describe what the following tail-recursive function computesand write an equivalent loop-based function:
def enigma(values, adjustment):
if
PayPal Gateway not configured
PayPal Gateway not configured