Past-paper question · 2013 October-November · Paper 32 · Q5(c)(i)

Question 5(c)(i) 2013 · October-November · Paper 32 · 1 mark

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

Official answer for Question 5

Part (c)

(i)

Part (c)

(i)

Items in order

[1]

Mark scheme 9691_w13_ms_32.pdf →

Show text version of question

Question 5

Part (c)

(i)

Question 5

Customer names are stored in the array Customer. For

Examiner's Use An algorithm is to be designed to perform a serial search of the array for a requested customer name.

The algorithm will use the variables shown in the table.

A
binary search may be an alternative algorithm to a serial search. For

Examiner's Use

(i)

What condition is put on the Customer array for a binary search to be used?

[1]

The following recursive function is for the binary search algorithm.

FUNCTION BinarySearch(ThisArray, FindValue, Low, High) : INTEGER IF High < Low THEN RETURN -1 // not found ELSE Middle ← INT((High + Low) / 2) IF ThisArray[Middle] > FindValue THEN BinarySearch(ThisArray, FindValue, Low, Middle – 1) ELSE IF (ThisArray[Middle] < FindValue) THEN BinarySearch(ThisArray, FindValue, Middle + 1, High) ELSE RETURN Middle // found ENDIF ENDIF ENDIF ENDFUNCTION

Topic relevance

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 9691_w13_qp_32.pdf

Keep practising this topic