Question 1
AQA Computer Science June 2019 Paper 1A level8 marks
On the specification
- 1.1
- 4.3 Fundamentals of algorithms
- 1.2
- 4.4 Theory of computation
- 1.3
- 4.4 Theory of computation
Question text
1 Figure 1 shows a bubble sort algorithm represented using pseudo-code. The algorithm sorts the data in a list L. Figure 1 PROCEDURE BubbleSort(L) N LEN(L) – 2 Count1 0 WHILE Count1 < LEN(L) – 1 FOR Count2 0 TO N IF L[Count2] > L[Count2 + 1] THEN Temp L[Count2] L[Count2] L[Count2 + 1] L[Count2 + 1] Temp ENDIF ENDFOR Count1 Count1 + 1 ENDWHILE ENDPROCEDURE 1.1 Describe two changes that could be made to this bubble sort algorithm that would be likely to result in fewer comparisons being made when sorting the list L. The algorithm should still be a bubble sort algorithm if your suggested changes were made. [4 marks] 1.2 ‘Sorting a list becomes an intractable problem when the size of the list is very large; it is a tractable problem when the size of the list is small.’ Explain why this statement is wrong. [2 marks] 1.3 Explain what approach(es) a programmer might take if asked to ‘solve’ an intractable problem. [2 marks]