Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2022/imperative-programming-resit/2/a/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2022 Imperative programming (resit) 2 a Solution by
Codex 0 2026-10-25
def search(f: Array[Array[Int]], x: Int): Option[(Int, Int)]Some((i,j)) denotes a match; None denotes absence. The extra array argument makes the dependence on the searched data explicit; if f is already enclosed in the surrounding scope, it can instead be omitted. For all implementations below, assume f is non-null, its rows are non-null and rectangular, and it remains unchanged during the search. Empty dimensions are permitted. New to topics? Read the docs here!