EuraStudy
This chapter asks the deepest questions in the subject: what does it mean to compute, what can and cannot be computed at all, and how efficiently can the possible be done. It develops computational thinking, the finite state machine and regular languages, Backus-Naur Form for describing syntax, the Turing machine as the definition of computation, the halting problem, and the classification of algorithms by their Big-O complexity - the mathematics that lets you compare algorithms rigorously.
5 sections~18 min reading time3 competenciesLevel Foundation 1 · Standard 1 · Advanced 3
basic level
AS-Level expects abstraction and decomposition, simple finite state machines and following/writing algorithms.
higher level
The full A-Level adds regular expressions and their equivalence to FSMs, BNF and context-free languages, Turing machines and the halting problem, and the classification of complexity with Big-O including intractability.
Reading depth: In depth
Text size: Standard
Typical mistakes
Active revision
Explain how you would use abstraction and decomposition to design a program that recommends the fastest bus route across a city, naming two sub-problems and stating one detail you would abstract away.
Active recall
Recall the key points — then reveal.
Sources: GCE AS and A level subject content for computer science (Department for Education) · AQA A-level Computer Science 7517 specification (AQA)
A finite state machine (parity of 1s)
Using the parity machine (start Even, accept Even; 1 switches state, 0 keeps it), decide whether the string 1101 is accepted, showing the state after each symbol.
Begin in the start state Even.
First 1: Even to Odd. Second 1: Odd to Even.
0: Even stays Even. Final 1: Even to Odd.
Result: The machine ends in Odd, which is not accepting, so 1101 is rejected. (It contains three 1s - an odd number - as the machine correctly detects.)
Typical mistakes
Active revision
Draw the state transition diagram and table for an FSM over the alphabet {a, b} that accepts exactly those strings ending in the substring 'ab'. Then state whether 'aab' and 'aba' are accepted.
Active recall
Recall the key points — then reveal.
Sources: AQA A-level Computer Science 7517 specification (AQA)
A BNF derivation tree for the number 42
Which of the strings 'ab', 'aab', 'b', 'aaab' are matched by the regular expression a*b (zero or more a's followed by a single b)?
a* means zero or more a's, so the string is any run of a's (possibly none) that must then be followed by exactly one b.
'ab' = one a then b: matches. 'aab' = two a's then b: matches. 'b' = zero a's then b: matches. 'aaab' = three a's then b: matches.
Result: All four match. In fact a*b matches exactly the strings of zero or more a's ending in a single b - the same language a two-state FSM would accept.
Typical mistakes
Active revision
List three strings matched by the regular expression and one that is not. Then, using the grammar , draw the derivation tree for 507.
Active recall
Recall the key points — then reveal.
Sources: AQA A-level Computer Science 7517 specification (AQA)
A Turing machine tape and head
Outline Turing's argument that no program H can decide, for every program P and input I, whether P halts on I.
Suppose H(P, I) always returns true if P halts on I and false if it loops forever - a perfect halting decider.
Construct a program X that, given a program P, runs H(P, P) and then does the opposite: if H says 'halts', X loops forever; if H says 'loops', X halts.
Ask what X does on input X. If X halts, then H(X, X) said 'halts', so by construction X loops - contradiction. If X loops, H said 'loops', so X halts - also a contradiction.
Result: Both cases are contradictory, so the assumed decider H cannot exist. The halting problem is undecidable - a permanent limit on what any computer can do.
Typical mistakes
Active revision
Explain why a Turing machine can recognise the language of balanced brackets while a finite state machine cannot, then state in your own words what the halting problem shows about the limits of computation.
Active recall
Recall the key points — then reveal.
Sources: GCE AS and A level subject content for computer science (Department for Education)
How complexity classes grow
The complexity hierarchy
Ordered from most to least scalable; each class grows strictly faster than the one before as increases.
Operations required at different input sizes
State the Big-O time complexity of this fragment and justify it: FOR i = 1 TO n; FOR j = 1 TO n; print(i, j); NEXT j; NEXT i.
For each fixed i, the inner loop runs n times, doing work per iteration - so the inner loop is .
The outer loop runs n times, and each of its iterations performs the inner loop, giving print operations.
The total work is proportional to ; constants and lower-order terms are dropped.
Result: The fragment is - quadratic. Doubling n quadruples the work, which is why nested loops over the whole input do not scale to large n.
Typical mistakes
Active revision
State the Big-O time complexity of: (a) accessing array[5]; (b) a single loop summing n items; (c) two nested loops each running n times; (d) binary search. Then explain, using , why an algorithm is intractable.
Active recall
Recall the key points — then reveal.
Sources: AQA A-level Computer Science 7517 specification (AQA)
References & sources
Department for Education