Login or Create an Account to view the mark scheme, comment, and add to a test
Consider the following recursive algorithm:
[4]
function mystery(arr, i) if i = 0 output "not found" return false if arr[i - 1] = 7 then output i return true else mystery(arr, i - 1) end if end function
State the output of mystery([3,1,5,7,9,2], 6) and describe what the mystery function generally achieves when used with i corresponding to the length of arr.

Short Answer4 MarksPremium
0 Uses0 Views0 Likes