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. On each recursive step the algorithm applies one pass of selection sort to have the last element in the array in its correctly ordered position then returns the concatenation of the next recursive call result together with the last element. The next recursive call is provided a sub array where the last element of the array has been removed. The above logic is captured in the following pseudocode.
function recSort(ARRAY) // base case required END_SORTED_ARRAY = onePassSelectionSort(ARRAY) return recSort(subArray(END_SORTED_ARRAY, 0, ARRAY.length - 2)) + END_SORTED_ARRAY[ARRAY.length - 1] end function
Identify, in words or pseudocode, the base case condition of this sorting algorithm.

Short Answer1 MarkPremium
12 Uses26 Views1 Like