Part I: Multiple choice (10 marks = 2 marks × 5)
For this part clearly write down the single choice that you believe is the most accuarate.
1. Let N and N0 be the number of division steps performed by Euclid’s GCD ...
1. Order the following functions from slowest growing to fastest growing by inspecting their graphs.
a. T(n) = n
b. T(n) = 1
c. T(n) = sqrt(n)
d. T(n) = n2
e. T(n) = log n
Answer
The order is from the slowest growing to ...
1) Implement the GCD (GreaterCommonDivisor) Algorithm
Input: Two positive integers, m and n
Output: The GCD of m and n
While (r ← m mod n) ≠ 0 ?←? ?←?
Output n
Answer
[php]
import java.util.Scanner;
public class lab1_part1 {
private int n;
private int m;
private void GCD(int ...