Solution
ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2006/ia/paper-5/1/a/solution
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 1 a Solution by
Codex 0 Created 2026-09-24 Updated 2026-10-14
Use the usual unit-cost model for Standard ML list constructors and fixed-size arithmetic. The input size in the list examples is the number of list elements, rather than the size of the integer entries. Inspecting only the first constructor has constant time complexity:No tail is traversed. The running time is .
sml
fun firstOrZero [] = 0
| firstOrZero (x :: _) = x; New to topics? Read the docs here!