Question 5(b) 2021 · May-June · Paper 41 · 5 marks
Reveal official mark-scheme answer
Official answer for Question 5
Part (b)
Question 1
mark per bullet point
Question 5
- If search value is greater, then recursive call…
- …with the mid + 1 sent in place as lower (and other correct parameters)
- If search value is less than recursive call…
- …with the mid − 1 sent in place as upper (and other correct parameters)
- Return −1 when not found AND Return mid when found
Show text version of question
Question 5
Part (b)
Question 5
A binary search algorithm searches for data in a sorted array.
Part (b)
The binary search algorithm can be written recursively.
Write program code for a recursive function recursiveBinarySearch().
Programming language ............................................................................................................
Program code
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Question 16
Why this question appears here
98% assigned-topic match · Computational thinking and problem-solving › Recursion
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_s21_qp_41.pdf
