Skip to content

Course home

Sorting algorithms

Sorting algorithms

EasyMediumHard
12345678910111213141516171819202122
Question 21

An algorithm is represented by the following pseudo-code, which processes a series of altitude measurements (in metres) recorded by an autonomous drone:

1  altitudes[0] ← 340.5
2  altitudes[1] ← 512.0
3  altitudes[2] ← 128.3
4  altitudes[3] ← 410.1
5  FOR p ← 0 TO 2
6      FOR q ← 0 TO 2
7          IF altitudes[q] < altitudes[q + 1] THEN
8              temp ← altitudes[q]
9              altitudes[q] ← altitudes[q + 1]
10             altitudes[q + 1] ← temp
11         ENDIF
12     ENDFOR
13 ENDFOR

State the purpose of this algorithm.

[1]
Markscheme

Sorting algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Sorting algorithms

52 exam-style questions on AQA GCSE Computer Science Sorting algorithms. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank