Quelpr

CAPE Computer Science Unit 2 · 2010 · Paper 2 · Question 2(a)(i)

An array of 10 integers is given: indices 0 to 9 with data 10, 3, 2, 15, 6, 5, 8, 11, 20, 19.

Describe how the selection sort algorithm works to sort a set of 10 integers in ascending order.

This question uses a figure or table from the paper — you'll see it when you practise.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 2(a)(ii)Draw the array after the first, second, and third passes of the selection sort algorithm (three diagrams in all).[3 marks]
  2. 2(b)A one-dimensional array num contains 20 unsorted integers. Write C code to accept an integer target from the user, search for it in num, print the location if…[10 marks]
  3. 2(c)State when binary search should be used on an array.[2 marks]

More practice: the rest of this paper · more Searching and Sorting Algorithms questions · all CAPE Computer Science Unit 2 past papers