48Medium
0/6

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

Figure 1

1  list ← [5, 4, 6]
2  sorted ← false
3  WHILE sorted = false
4      sorted ← true
5      i ← 0
6      WHILE i < 2
7          IF list[i] > list[i+1] THEN
8              temp ← list[i]
9              list[i] ← list[i+1]
10             list[i+1] ← temp
11             sorted ← false
12         ENDIF
13         i ← i + 1
14     ENDWHILE
15 ENDWHILE
sorteditemplist[0]list[1]list[2]
false546
true0
545
[6]

Sorting algorithms Questions

Practise AQA GCSE Computer Science Sorting algorithms with exam-style questions for GCSE Computer Science. 62 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

PreviousNext

Sorting algorithms Questions

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