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];
O(1) O(n^.5) O(n) O(n^2) none of the above
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?
$O(100 n^2 + 5n + 1)$ is bigger they are the same $O(n^2 + 5n + 100)$ is bigger
5. How do $O(10 n^2)$ and $O(2 n^10)$ compare?
$O(10 n^2)$ is bigger they are the same $O(2 n^10)$ is bigger
6. How do $O(10)$ and $O(1)$ compare?
$O(10)$ is bigger they are the same $O(1)$ is bigger
7. How do $O(1 + 1/n)$ and $O(2)$ compare?
$O(1 + 1/n)$ is bigger they are the same $O(2)$ is bigger
8. How do $O(n+log(n))$ and $O(n)$ compare? ($log$ is the natural log.)
$O(n+log(n))$ is bigger they are the same $O(n)$ is bigger