Question 12(a) 2022 · October-November · Paper 33 · 6 marks
Reveal official mark-scheme answer
Official answer for Question 12
Part (a)
Question 6
Show text version of question
Question 12
Part (a)
The array Names[0:99] is in alphabetical order.
Complete this pseudocode binary search algorithm.
Lower ←0 ...................................................................................................... Mid ← 0 Exit ← FALSE OUTPUT "Enter the name to be found " INPUT Target REPEAT
....................................................................................................... THEN
OUTPUT Target, " does not exist" Exit ← TRUE ENDIF Mid ←Lower + (Upper – Lower + 1) DIV 2 IF Names[Mid] < Target THEN
Lower ← ..................................................................................................... ENDIF IF Names[Mid] > Target THEN
..................................................................................................... ENDIF
...................................................................................................... THEN OUTPUT Target, " was found at location ", Mid Exit ← TRUE ENDIF
......................................................................................................
Why this question appears here
82% assigned-topic match · Algorithm design and problem-solving › Algorithms
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 9618_w22_qp_33.pdf
