Past-paper question · 2018 October-November · Paper 42 · Q3(c)

Question 3(c) 2018 · October-November · Paper 42 · 4 marks

Original past-paper question for 3(C)
Original past-paper question for 3(C)
Original past-paper question for 3(C)
Reveal official mark-scheme answer Official mark-scheme answer for 3(C)

Official answer for Question 3

Part (c)

Question 1

mark per bullet

Question 4

✓
•
✓
Use of a (Boolean) flag«
✓
•
✓
«Remainder of bubble correct
✓
•
✓
Set flag when a swap has been made«
✓
•
✓
«Loop until a swap has not been made and then exit all loops
✓
Outer ← LENGTH(List)-1
✓
REPEAT
✓
Inner ← 0
✓
Swap ← FALSE
✓
REPEAT
✓
IF List[Inner] > List[Inner + 1]
✓
THEN
✓
Temp ← List[Inner]
✓
List[Inner] ← List[Inner + 1]
✓
List[Inner + 1] ← Temp
✓
Swap = TRUE
✓
ENDIF
✓
Inner ← Inner + 1
✓
UNTIL Inner = Outer – 1
✓
Outer ← Outer - 1
✓
UNTIL Swap = FALSE OR Outer = 0
✓
9608/42
✓
Cambridge International AS/A Level – Mark Scheme
✓
October/November 2018
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_w18_ms_42.pdf →

Show text version of question

Question 3

Part (c)

Question 3

A bubble sort algorithm is used to sort an integer array, List. This algorithm can process arrays

of different lengths.

Part (c)

Use pseudocode to write an alternative version of this bubble sort algorithm that will exit the

algorithm when the list is fully sorted.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

..............................................................................................................................................

[4]

Question 8

Topic relevance

Why this question appears here

92% 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_w18_qp_42.pdf

Keep practising this topic