CMPE/CISC 365 - Lab 1

Submit your answers as "Quiz 1" on OnQ.

No work or derivations are to be provided in your submission ... just the answers.

Yes or no

Is $\log^k n \in {\cal O}(n)$ for any $k \geq 1$ ?

Is $n^{0.001} \in {\cal O}( \log n )$ ?

Is $n^k \in {\cal O}(2^n)$ for any $k \geq 1$ ?

Problems and algorithms

Suppose all algorithms that solve a particular problem are in $\Omega( n^3 )$.

Using the above fact, what is the strongest statement (of those below) that can be made about the fastest algorithm that solves this problem in time $f(n)$?

Tail recursion

What is the asymptotic complexity of

$\displaystyle T(n) = \left\{ \begin{array}{ll} c & \textrm{ if } n < 1 \\ f(n) + T(n-1) & \textrm{ otherwise} \\ \end{array} \right.$

More general recursion

What is the asymptotic complexity of

$\displaystyle T(n) = \left\{ \begin{array}{lcl} c && \textrm{if } n \leq 1 \\ n + a \; T( {n \over b} ) && \textrm{otherwise} \\ \end{array} \right.$

when a,b = 2,4?

when a,b = 3,3?

when a,b = 4,2?

Tightest bound

What is the tightest aymptotic complexity (from the list below) of

$\displaystyle T(n) = \left\{ \begin{array}{lcl} c && \textrm{if } n \leq 2 \\ T(n-1) + T(n-2) && \textrm{otherwise} \\ \end{array} \right.$