Recursion Tree
|
Document last modified:
|
Use a recursion tree to determine a good asymptotic upper bound
guess on the following recurrence:
| where T(n) = |
1 when n = 1 |
|
T(n-1) + n when n > 1 |
Steps:
-
Draw the tree based on the recurrence
-
From the tree determine:
-
# of levels in the tree
-
cost per level
-
# of nodes/level
-
# of nodes in the last level
-
cost of the last level (which is based on the number found in 2d)
-
Write down the summation using
S notation – this summation sums up the cost of
all the levels in the recursion tree
Use a recursion tree to determine a good asymptotic upper bound
on the following recurrence:
| where T(n) = |
1 when n = 1 |
|
4T(n/2) + n when n > 1 |