: which is O(n2 (10/9)log3 n) = O(n1.095...). |
Conclude T(n) ≤ 6 n . |
Conclude T(n) ≤ 6 n . |
Try these:
1. recurrence tree is a complete binary tree of depth log3 n. The Ith level from the top has 2i nodes, each with work n/3i.
Total work is
2. same as above but each node has 3 children, so the Ith level from the top has 3i nodes.
Total work is
3. now each node has 4 children, so total work is
Oh yeah? Try these!
1. recurrence tree is of depth log3 n. Each node has 8 children. The Ith level from the top has 8i nodes, each with work (n/3i)2 = n2 / 9i .
Total work is
2. Total work is
3. Total work is
No recursion tree!?
Try repeated substitution.
After substitutions, get (1.5)i T(n / 3.1i) + (1.5)i-1 [n/3.1i-1]0.5 + ... .
Total work is
Since 1.5 < 3.10.5, this is O(n0.5).
Can make a recursion tree for this. Every node has two children, but depth is uneven, and work is not the same for each node on a level. Try guessing, then prove by induction.
Guess that T(n) ≤ 10 n. Attempt proof by induction:
What is the best constant that would work?
Guess that T(n) ≤ c n. Attempt proof by induction:
Need c(1/3+1/2)+1 ≤ c . True iff c ≥ 6 .
Conclude T(n) ≤ 6 n .