Assignment 2
Assignment 2
Trimester 1, 2019
Assignment 2
Due date: Friday, May 3rd, 11.59 pm
1. Let Z be the set of integers, R the set of real numbers, A = {-5,0,2,5} and
B = {5,13,55}. For each of the following functions check whether or not it is both 1:1
and onto.
2. Use bubblesort to arrange the numbers 91, 68, 52, 77, 14 and 18 into ascending
order. Write the list after each exchange of numbers. How many comparisons are
there altogether?
5. Find the greatest common divisors and least common multiples for each of the
following pairs of integers.
7. (a) Convert the following integers from the given base into base 10
8. Use the Euclidean Algorithm to find the greatest common divisors of each of the
following pairs of integers:
1 1 5 0 2
9. Given that A = 3 0 1 and B = [−1 −2] calculate, if possible:
(i) BA (ii) AB
(iii) AT B (iv) B2