Login or Create an Account to view the mark scheme, comment, and add to a test

A search algorithm uses recursion to sort a one-dimensional array by sorting the end of the array and returning the array minus the last element at each recursive step.

(a).

Identify, in words, what the base case of this sorting algorithm must be

[2](b).

Outline how binary tree traversal uses the concept of recursion

[2]Consider the following algorithm
func(N)
if N=0 then
return 1
else if (N % 2 == 0)
return N - func(N-1)
else
return N + func(N-1)
end if
end method

(c).

State what would occur if the first "if statement" was removed

[1](d).

Trace the algorithm when N=4

[4](e).

State the final output of the algorithm when N=4

[1]Extended Response10 MarksCommunity

25 Uses72 Views1 Like