An atmospheric scientist is writing a bubble sort algorithm to sort barometric pressure readings (in hPa) in ascending order.
1 CONSTANT N ← 4
2 readings ← [1013, 1008, 1015, 998]
3 FOR i ← 0 TO N - 2
4 FOR j ← 0 TO N - i - 2
5 IF readings[j] > readings[j+1] THEN
6 temp ← readings[j]
7 readings[j] ← readings[j+1]
8 readings[j+1] ← temp
9 ENDIF
10 ENDFOR
11 ENDFOR
Identify which of the options contains the false statement about the algorithm in Figure 1.
The algorithm sorts the array in descending order.
The total number of key comparisons performed during execution is 666.
The total number of swap operations executed during execution is 444.
The algorithm utilizes nested definite iteration.
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.