Lecture 2
Today’s topics: Divide and Conquer and Algorithm Analysis
- Divide and Conquer, in particular how to derive a recurrence relation for the running time.
- More on $O$,$\Theta$, and $\Omega$
- The Master theorem and how to apply it.
Slides used
Reading Guide
Chapter 3 and 4 (except 4.6) of CLRS3 or Chapter 3 and 4 (except 4.6 and 4.7) of CLRS4.
You might find the following slides useful: Divide and Conquer I which has some more examples on algorithm analysis, and Divide and Conquer II that has information on the master theorem.
What should I know by the end of this lecture?
You should know much more about the Big O notation. In particular
- General algebra with $O$, $\theta$ and $\Omega$. For example when is $O(f(n)) \leq O(g(n))$?
- Constant time $O(1)$.
- Linear time $O(n)$, polynomial time, exponential time
- The rate of different asymptotic growths.
Further you should know about divide and conquer an algorithm design technique and the Analysis of Divide and Conquer using recurrence relations. You should understand and be able to reproduce a simple divide and conquer analysis of an algorithm such as binary search or merge sort. You should understand how to go from recurrence relations such as $$ T(n) = aT(n/b) + f(n) $$ to asymptotic analysis of the function $T(n)$. For which functions $g$ is the following statement true: $$ T(n) \in O(g(n)) $$
Although I do not expect expect you understand the proof, you should try to get an intuition of the different cases of the master theorem.