Q1: Write an algorithm to compute the sum of n cube numbers. Also, compute the complexity of the algorithm. (25 Marks)
Q2: List the five applications of linear and non-linear data structures. (1 Mark)
Q3: Order the following functions by asymptotic growth rate: n^2 + 2n, 210, 2^(3n) + 100logn, n!, 2^n, n^(t+10), n^2, nlogn, n^s. (25 Marks)
Q4: Using Big-Oh Notation, justify that the asymptotic growth rate of function f(n) = n^3 + 4n^2 + 5n + 10 is O(n^5). (Mark)
Q5: Give a Big-Oh characterization in terms of n for the running time of the following code: (Mark)
public static int example3(int[] arr) {
int n = arr.length;
int total = 0;
for (int j = 0; j < m; j++) {
for (int k = 0; k <= n; k++) {
total = j * k;
}
}
return total;
}