Week
7 : Extra Programming Exercise (not marked or handed in)
Question 1: Unordered linear search
Write a recursive function that performs unordered linear search.
Question 2: Greatest Common Divisor
Write a recursive function to computer the greatest common divisor (gcd) of two integers. The gcd of two integers is the largest integer that divides them both. A recursive definition of gcd is
gcd(m, n) = n (if n divides m)
= gcd(n, remainder of m divided by n) (otherwise)
Question 3: Binary search
Write a recursive function that performs binary search.
Question 4: Selection sort
Write a recursive function that performs selection sort.
Question 5: Bubble sort
Write a recursive function that performs bubble sort.