Name: ____________________________________________________ Alpha: _____________________
Describe help received: _________________________________________________________________
Per-problem assessment:
• 5 (Perfect): Correct solution
• 4 (Good effort): Good effort, solution may or may not be correct.
• 2 (Poor effort): Some basic misunderstandings demonstrated that could have
been cleared up by reading the notes or giving a serious try.
• 0 (No effort): No progress towards a solution.
Problem 1 (assessment: self_______ final_______)
Consider linearSearch and binarySearch from the Unit 1 notes.
The analysis in Section 8 shows that the worst case running time
in terms of number of operations for linearSearch on an array range of
size $n$ is
$
T_{ls,\text{worst}}(n) = 2n + 1 \text{ operations}
$
and the the worst case running time
in terms of number of operations for binarySearch on an array of
size $n$ is
$
T_{bs,\text{worst}}(n) = 5 \lg n + 4 \text{ operations}
$
whereas the best case for each is
$
T_{ls,\text{best}}(n) = 3 \text{ operations}
$
for linearSearch and
$
T_{bs,\text{best}}(n) = 5 \lg n + 4 \text{ operations}
$
for binarySearch. Given that, here are some T/F questions to
see whether you understand the meanings of $O$, $\Theta$ and
$\Omega$ and how they're used to describe running time
functions:
- $T_{ls,\text{worst}}(n) \in \Theta(n)$
- $T_{ls,\text{worst}}(n) \in \Omega(1)$
- $T_{bs,\text{worst}}(n) \in O(n)$
- $T_{bs,\text{worst}}(n) \in \Omega(\lg n)$
- $T_{ls,\text{best}}(n) \in \Omega(n)$
- $T_{ls,\text{best}}(n) \in \Theta(1)$
- $T_{ls,\text{best}}(n) \in O(n)$
- $T_{bs,\text{best}}(n) \in \Omega(n)$
- $T_{bs,\text{best}}(n) \in O(\lg n)$
- $T_{bs,\text{best}}(n) \in O(n)$