Exercise E10; due by 8am, Tuesday, March 13

Answer the multiple choice questions below about material (e.g. big-oh notation) from the 3/08 lecture and the 3/06 and 3/08 lecture sketches.

0. NetID (not CUID):

1. How long (#elements) does vector $x$ get in function $f$ below? (Note: the question is about space, not time.)

    function x = f(n)
        x = [n];

2. How long (#elements) does vector $x$ get in function $g$ below? (Note: the question is about space, not time.)

    function x = g(n)
        x = 1:n;

3. How long (#elements) does vector $x$ get in function $h$ below? (Note: the question is about space, not time.)

    function x = h(n)
        x = [2];
        for j = (n-5):(n+5)
            x = [x 2];
        end

4. How do $O(100 n^2 + 5n + 1)$ and $O(n^2 + 5n + 100)$ compare?

5. How do $O(10 n^2)$ and $O(2 n^10)$ compare?

6. How do $O(10)$ and $O(1)$ compare?

7. How do $O(1 + 1/n)$ and $O(2)$ compare?

8. How do $O(n+log(n))$ and $O(n)$ compare? ($log$ is the natural log.)