Question 5(b)(ii) 2015 · May-June · Paper 42 · 5 marks
Reveal official mark-scheme answer
Official answer for Question 5
Part (b)
(ii)
(ii)
NumberOfItems 10
- change outer loop to a REPEAT/WHILE loop
- FOR loop has variable used for final value
- Initialise Boolean variable to TRUE
- set Boolean variable to FALSE in correct place
- number of items to consider on each pass decrements
- Correct stopping condition for REPEAT loop
Show text version of question
Question 5
Part (b)
(ii)
Question 5
Data is stored in the array NameList[1:10]. This data is to be sorted.
An alternative sort algorithm is a bubble sort:
FOR ThisPointer ← 1 TO 9 FOR Pointer ← 1 TO 9 IF NameList[Pointer] > NameList[Pointer + 1] THEN Temp ← NameList[Pointer] NameList[Pointer] ← NameList[Pointer + 1] NameList[Pointer + 1] ← Temp ENDIF ENDFOR ENDFOR
(ii)
Rewrite the algorithm in part (b), using pseudocode, to reduce the number of
unnecessary comparisons. Use the same variable names where appropriate.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
......................................................................................................................................
Question 13
Why this question appears here
71% 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 9608_s15_qp_42.pdf
