Exam Questions Flashcards
What is the logarithm change of base trick?
What is the logarithm change of exponential base trick?
What is the Geometric series?
What are the steps the recursion tree method?
- Draw the tree
- Calculate the work per level, continue until level k
- Find the number of levels: Find for which k you only have one element left (thus just n/(b^k) = 1)
- Sum work: So just sum from 0 until what you found in step 3
- Bound this sum
How do you find the number of levels in the recursion tree method?
You have a formula by which n decreases per layer. I.e.
n/(b^k). Equate this to one, and solve.
What is the Master theorem if a = b^d?
O(n^d log_2 n)
What is the Master theorem if a < b^d?
O(n^d)
What is the Master theorem if a > b^d?
O(n^(log_b a))
How to use the substitution method if T(n) = [..]T(n-a)[..]?
What are the inductive steps when proving a looping/recurring algorithm?
- Loop/Recurring invariant
- Initialization
- Maintenance
- Termination
How to prove the correctness of an algorithm?
By induction, but they do not really ask for high quality proofs.