Question 2
AQA Computer Science June 2023 Paper 1 (7516/1)AS11 marks
On the specification
- 3.4 Theory of computation
Question text
2 The algorithm, represented using pseudo-code in Figure 2, describes a method to rearrange four numbers in a data structure. Figure 2 Numbers[0] ← 45 Numbers[1] ← 19 Numbers[2] ← 62 Numbers[3] ← 12 FOR X ← 1 TO 3 Y ← X - 1 N ← Numbers[X] WHILE Y > -1 AND N < Numbers[Y] Numbers[Y + 1] ← Numbers[Y] Y ← Y - 1 ENDWHILE Numbers[Y + 1] ← N ENDFOR Complete Table 2 by hand-tracing the algorithm in Figure 2. You may not need to use all the rows in Table 2. The first row of Table 2 has already been completed for you. Table 2 Numbers X Y N [0] [1] [2] [3] 45 19 62 12 Copy the contents of all the unshaded cells in Table 2 into your Electronic Answer Document. [5 marks]