1. 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)

  1. Give an example of a problem for which recursion is anappropriate solution. Justify your answer.

  1. Describe what the following tail-recursive function computesand write an equivalent loop-based function:

def enigma(values, adjustment):

if len(values) == 0:

    returnadjustment

if values[0] == 0:

    adjustment += 1

        returnenigma(values[1:], adjustment)