Question 3
OCR Computer Science June 2025 Algorithms and problem solving (H046-02)AS6 marks
On the specification
- 2.3 Algorithms
Question text
3 A student has written this algorithm in pseudocode: for x = 1 to 4 item = data[x] y = x - 1 while (y >= 0) and (item < data[y]) data[y + 1] = data[y] y = y - 1 endwhile data[y + 1] = item next x Test the algorithm by completing the trace table. The array data is a 1-dimensional array with 5 positions initialised with the data shown in the trace table. You should continue your answer on the next page if you need more space. data x item y 0 1 2 3 4 10 2 5 20 19 [6] Additional space for question 3 if required. data x item y 0 1 2 3 4