Algorithms CSCI 235, Spring 2019 Lecture 8 Recurrences III
Other examples T(n) = T(n/2) + n T(n) = 2T(n/2) + n2 3. T(n) = T(n/3) + T(2n/3) + n
Practice with recurrences Example 1: T(n) = T(n/2) + n We will draw the tree in class
Solving example 1 Cost of level k = ? T(n) = ? A lower bound: An upper bound: T(n) = ?
Example 2 Another equation: T(n) = 2T(n/2) + n2 We will draw this tree in class
Solution for example 2 Cost of level k = ? T(n) = ? Lower bound: Upper bound: T(n) = ?
Example 3 Practice equation 3: T(n) = T(n/3) + T(2n/3) + n We will draw this tree in class
Solving Recursion tree for example 3 Number of levels = ? Cost of each level = ? Total cost if tree is full = ? Some paths will be shorter, so cost will be less. Total cost is at most? T(n) = ?