Skip to content

Course home

Sorting algorithms

Sorting algorithms

EasyMediumHard
123456789101112131415161718192021222324252627
Question 5

Complete the trace table for the algorithm shown in Figure 1. Some values have already been entered.

Figure 1

1  list ← [7, 2, 9]
2  changed ← false
3  WHILE changed = false
4      changed ← true
5      i ← 0
6      WHILE i < 2
7          IF list[i+1] < list[i] THEN
8              temp ← list[i]
9              list[i] ← list[i+1]
10             list[i+1] ← temp
11             changed ← false
12         ENDIF
13         i ← i + 1
14     ENDWHILE
15 ENDWHILE
changeditemplist[0]list[1]list[2]
false729
true0
727
[6]
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