Past-paper question · 2019 May-June · Paper 42 · Q4(a)(ii)

Question 4(a)(ii) 2019 · May-June · Paper 42 · 1 mark

Original past-paper question for 4(A)(II)
Original past-paper question for 4(A)(II)
Original past-paper question for 4(A)(II)
Original past-paper question for 4(A)(II)
Reveal official mark-scheme answer Official mark-scheme answer for 4(A)(II)

Official answer for Question 4

Part (a)

(ii)

✓
Linear search

Question 1

Mark scheme 9608_s19_ms_42.pdf →

Show text version of question

Question 4

Part (a)

(ii)

A
program has sorted some data in the array, List, in ascending order.

The following binary search algorithm is used to search for a value in the array.

01 ValueFound FALSE 02 UpperBound LengthOfList - 1 03 LowerBound 0 04 NotInList FALSE 05 06 WHILE ValueFound = FALSE AND NotInList = FALSE 07 MidPoint ROUND((LowerBound + UpperBound) / 2) 08 09 IF List[LowerBound] = SearchValue 10 THEN 11 ValueFound TRUE 12 ELSE 13 IF List[MidPoint] < SearchValue 14 THEN 15 UpperBound MidPoint + 1 16 ELSE 17 UpperBound MidPoint – 1 18 ENDIF 19 IF LowerBound > MidPoint 20 THEN 21 NotInList TRUE 22 ENDIF 23 ENDIF 24 ENDWHILE

Question 25

26 IF ValueFound = FALSE 27 THEN 28 OUTPUT "The value is in the list" 29 ELSE 30 OUTPUT "The value is not found in the list" 31 ENDIF

Note: The pseudocode function ROUND(Reall : REAL) RETURNS INTEGER rounds a number to the nearest integer value. For example: ROUND(4.5) returns 5 and ROUND(4.4) returns 4

Question 17

(ii)

A binary search is one algorithm that can be used to search an array.

Identify another searching algorithm.

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

[1]

Question 18

Topic relevance

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_s19_qp_42.pdf

Keep practising this topic